|
Luis Alonso Ramos wrote:
the only problem would be hit testing for the elements...
OpenGL supports hit testing very good.
--
Nice greets, Daniel.
|
|
|
|
|
this line of code
IFormatter formatter = new BinaryFormatter();Stream stream = new FileStream("MyFile.bin", FileMode.Create, FileAccess.Write, FileShare.None);formatter.Serialize(stream, obj);stream.Close();
alwas write data at the end of file or not ?
i mean there are alot of Objects .
where it write in the file?
this line of code
object obj = formatter.Deserialize(stream);
alwas read data from the begining of file or not ?
i mean there are alot of Objects.
where it read from the file?
r00d0034@yahoo.com
|
|
|
|
|
I need to catch mouse events, even when the mouse is not over any of my forms or controls.
Ideally, I could selectively choose to either pass on the message to the window that should have gotten it, or trap it.
Anybody have an idea?
|
|
|
|
|
Fortunately, there is no C# way of doing this : mouse events are attached to controls.
if you start putting in too manay features, it no longer remains useful for beginners
quote in a CP article comment, shiraz baig
|
|
|
|
|
Can I do it using interop?
|
|
|
|
|
I don't if it works or not. Because I've never used this feature
Correct me if I am wrong
There is a property called Capture in Control Class. It can be
set to true if you wish to capture all mouse events, even outside
the control's borders.
The following text is copied from MSDN:
---
When a control has captured the mouse, it receives mouse input whether or not the cursor is within its borders. The mouse is typically only captured during drag operations.
Only the foreground window can capture the mouse. When a background window attempts to do so, the window receives messages only for mouse events that occur when the mouse cursor is within the visible portion of the window. Also, even if the foreground window has captured the mouse, the user can still click another window, bringing it to the foreground.
When the mouse is captured, shortcut keys do not work.
---
Hope this would help
|
|
|
|
|
just tested it.
It looks the scope is rather limited. Even you set it true,
you still can't capture mouse events outside its top parent
control...
|
|
|
|
|
Hmmm, that isn't very helpful in this situation, but good to know overall.
Anybody else?
|
|
|
|
|
there's useful project on "the evil other site"
http://www.codeguru.com/system/Lock.shtml
the secret is: you need to install a system-hook. the one capturing mouse-events needs to reside in a dll.
i once did that with C++ but i have no idea whether this works with C#...
:wq
|
|
|
|
|
my userControl derived control responds to the mouse wheel when the app starts, but as soon as the focus passes over to something else, the mouse wheel doesnt work, even after manually scrolling the bar, and clicking in the area of the control, to make sure it has focus, or is there something special needed to actually give it focus?
Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk "All programmers are playwrights and all computers are lousy actors."
|
|
|
|
|
Do you mean with or without the cursor positioned over the control?
If you mean with the cursor not over the control, thats just the way scrolling with a wheel works.
Take this browser window for instance; resize it so it only takes up half the screen, then place the cursor over the non-browser portion of the screen. If you move the mouse wheel the window will no longer scroll.
James
Sig code stolen from David Wulff
|
|
|
|
|
|
HOW to creat FileStream object that could write into a file ?
can you explain any of its constructor?
i need a little more help how to write data using FileStream into a file or read the object from a file to the FileStream object only then it is possible to serialize or Deserialize it?
i want to write a hastable object into a file that contain class objects,and class objects further contain hashtable and other class objects.
may i write that hashtable into a file and retrive again?
i study the api but could not understand what methods to use.
r00d0034@yahoo.com
|
|
|
|
|
[Serializable]
public class MyObject {
public int n1 = 0;
public int n2 = 0;
public String str = null;
}
MyObject obj = new MyObject();
obj.n1 = 1;
obj.n2 = 24;
obj.str = "Some String";
IFormatter formatter = new BinaryFormatter();
Stream stream = new FileStream("MyFile.bin", FileMode.Create, FileAccess.Write, FileShare.None);
formatter.Serialize(stream, obj);
stream.Close();
And of course, you've got a System.Collections.HashTable object to play with.
See here[^]
if you start putting in too manay features, it no longer remains useful for beginners
quote in a CP article comment, shiraz baig
|
|
|
|
|
thanks.
one more question.this line of code
formatter.Serialize(stream, obj);
alwas write data at the end of file or not ?
i mean there are alot of Objects .
where it write in the file?
this line of code
object obj = formatter.Deserialize(stream);
alwas read data from the begining of file or not ?
i mean there are alot of Objects.
where it read from the file?
r00d0034@yahoo.com
|
|
|
|
|
Most probably yes, each call to Serialize appends data at the end.
But in fact you need not care about it, that's internal implementation. You must only make sure that your own serialization/deserialization are dual, ie do exactly the same thing. For instance :
// serialize
formatter.Serialize(s, obj1);
formatter.Serialize(s, obj2);
formatter.Serialize(s, obj3);
// deserialize
formatter.Deserialize(s, obj1);
formatter.Deserialize(s, obj2);
formatter.Deserialize(s, obj3);
if you start putting in too manay features, it no longer remains useful for beginners
quote in a CP article comment, shiraz baig
|
|
|
|
|
I have MFC COM server with interface that has a method declared as
[id(1)] void TRYOUT(VARIANT* pv); in ODL and
void CI::TRYOUT(VARIANT FAR* pv) {...} in the implementation.
C# sees it as
void CI.TRYOUT (ref object pv);
So here what I do:
Object oRes= new Object();
oI.TRYOUT(ref oRes); // oI is referenced instance of CI
And I get exception - type mismatched.
What's wrong?
Please help!
|
|
|
|
|
It seems from what you say that the compilation went fine, and it failed at run-time, right?
From my personal experiments, I would avoid to use VARIANT* because the marshaler does not know how to marshall all variant subtypes.
You may need to add a [MarshalAs...] attribute to bind to a specific subtype, especially if you know that VARIANT* references a BSTR for instance.
if you start putting in too manay features, it no longer remains useful for beginners
quote in a CP article comment, shiraz baig
|
|
|
|
|
How do I use MarshalAs in Cleint app?
I looks like it's an attribute in interface declaration.
Also. How do you pass an array of longs backfrom MFC server to C# client without using VARIANT*?
And! How do you pass an array of strings from C# cleint to MFC server?
|
|
|
|
|
you need not an interface declaration to put a MarshalAs attribute. Get used to it. You can put attributes ANYWHERE in your code.
you usually pass an array of long as a SafeArray .
You've got doc and sample code here [^]and here[^].
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
Can anyone tell me how to go about setting up and using an MS-SQL connection (ADO) in C#?
Thanks,
Derek
|
|
|
|
|
Maybe this help you:
http://www.codeproject.com/aspnet/adodotnet.asp[^]
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
I create an app in C# and put my controls on right side. I intend to dock an Outlook type toolbar on the left. So inside the development I have two forms My original form NHN.cs and my outlook bar called OLBar.cs I want to doc the OLBar.cs to the left side of NHN.cs.
1) How is this accomplished.
2) The Outlook Bar code that I download from http://www.codeproject.com/cs/miscctrl/outlookbar.asp seems to be a nice
toolbar but for the life of me I can't get that docked to the left onto my NHN.cs form.
Has anyone used this Outlook toolbar that might be able to offer some help OR does anyone know another way to add an outlook toolbar on a form?
Many Thanks,
Derek
Derek@NeedHelpNow.com
|
|
|
|
|
You basically need to use the DockStyle to position elements on a container type object.
You could create a panel to host your forms. Assuming Form1 is the one you want on the right side, you could do something like this:
panelRight = new Panel();
panelRight.Dock = DockStyle.Fill;
form1 = new Form1();
form1.Parent = panelRight;
panelLeft = new Panel();
panelLeft.Dock = DockStyle.Left;
splitter1 = new Splitter();
this.Controls.AddRange(new System.Windows.Forms.Control[]
{panelRight, splitter1, panelLeft});
The order of adding things to this.Controls above is important.
panelLeft could be the parent of your Outlookbar control.
Gaulles
http://www.gaulles.com
|
|
|
|
|
Derek Smigelski wrote:
Has anyone used this Outlook toolbar that might be able to offer some
I have used it.
I use a panel (which I can change) that fills all the client area of my main window (panel.Dock = DockStyle.Fill).
Then I create a Splitter, assignig its parent as the main form, and set its Dock property to DockStyle.Left.
Finally I create the outlook bar, I assign its parent as the main form, and set its Dock property again to DockSytle.Left.
And there, you have a resizable Outlook bar on the left.
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|