|
This is a ***BUG***, create a simple C# Windows based form. Drop a treeview on the form, add a MouseUp event handler for the TreeView. Add Console.WriteLine("MouseUp Fired");
Start the application, press and hold Left mouse button inside of the treeview, note the MouseUp event is fired even though the mouse button hasn't been released?
Work arounds anybody?
Normski. - Professional Windows Programmer
|
|
|
|
|
Hello Norm
I just reproduced the bug
Sucks!!!
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Norm Almond wrote:
Work arounds anybody?
Normskyyyy
We both have been such fools. We were both trying it on an empty treeview.
Add some nodes. If you click on a node, the mouse down event is fired. And when you release the mouse, the mouse up event is fired.
But even on a tree view with nodes, if you click on a non-node area then the earlier behaviour occurs where the mouse-down event is immediately followed by the mouse-up event.
Maybe what they do is to see if we have clicked on a node. If not they also send a mouse-up message
regards
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Nish this behaviour is not the same when using the raw API to crack WM / NM /LVM type messages. Surely the behaviour should be the same as in .NET as it is in MFC/C/C++.
Keep getting signed out from hotmail
|
|
|
|
|
I've been playing around with the dynamic sizing, positioning, and MDI
settings, but still can't achieve my goal and I'm sure someone else out
there has done this... Here's my scenario:
I have a frmMainContainer that acts as the primary controller for my
application. It consists of a header 200px tall and 100% of the width of
the form (used for control & branding) and the remainder of the area below
is where my other forms will appear (I'll call it MultiUseArea for this
conversation). I have a few other forms (frmChild1, frmChild2,
frmChild3)... these will be loaded from the frmMainContainer form... they
also will not have the min/max/close/titlebar/border features of a typical
form.
Now, what I want to do is click basically click a button in frmMainContainer
that will load one of the child forms into the MultiUseArea... here's the
trick... I want to size the child form to take up 100% of the MultiUseArea.
Here's what I'm struggling with: when I load the application
frmMainContainer, there are no scrollbars. When I load one of the child
forms, scroll bars pop up in frmMainContainer although it looks like if the
scroll bars weren't present, it would fit perfectly.
I've tried dynamically sizing the children using the ClientRectangle
property of the frmMainContainer, I've tried disabling the AutoScroll, and
making the child forms MDI children of the frmMainContainer among other
things... I just can't figure it out. Any ideas?
----
Just in case I'm confusing anyone in my description... I'm thinking something like Quicken interface or the one shown here: http://www.bcentral.com/image/ss_sbm1_640.gif In my desired solution, the "invoice entry" form would not have the title bar or control boxes (min/max/close).
Andrew Connell
IM on MSN
andrew@aconnell.com
|
|
|
|
|
Got it...
<begin code>
Form2 frmForm2 = new Form2();
frmForm2.TopLevel = false; //<<< KEY CODE
frmForm2.Parent = this; //<<< KEY CODE
//position 200px down from top because top 200px are my app header
System.Drawing.Point thePoint = new System.Drawing.Point(0, this.ClientRectangle.Y+200);
frmForm2.Location = thePoint;
//size child form to fill up 100% of the parent form EXCEPT for the upper [form width]x200
System.Drawing.Size theSize = new System.Drawing.Size(this.ClientRectangle.Width, this.ClientRectangle.Height-200);
frmForm2.Size = theSize;
frmForm2.Show();
<end code>
Andrew Connell
IM on MSN
andrew@aconnell.com
|
|
|
|
|
Here's the structure in C:
typedef struct _SYSTEM_INFO {
union {
DWORD dwOemId;
struct {
WORD wProcessorArchitecture;
WORD wReserved;
};
};
DWORD dwPageSize;
LPVOID lpMinimumApplicationAddress;
LPVOID lpMaximumApplicationAddress;
DWORD_PTR dwActiveProcessorMask;
DWORD dwNumberOfProcessors;
DWORD dwProcessorType;
DWORD dwAllocationGranularity;
WORD wProcessorLevel;
WORD wProcessorRevision;
} SYSTEM_INFO;
Although I read the tutorial in the MSDN, I could not figure out how to do this...
Could you please give me a hand?
Thank you in advance for your effords!
|
|
|
|
|
I could be wrong, but it looks as if you are trying to access system information about the computer, you just want to do this in C#, am I right? If so there is an article on the WMI (Windows Management Interface) that will show you how to do this. I know this isn't the exact answer to your question, but it should hopefully help. Interrogating Systems with WMI
HTH
Nick Parker
|
|
|
|
|
Thank you for your reply,
You're right in gussing I want to access system information. I want to get the number of CPU on the machine, can I do that using WMI?
|
|
|
|
|
Hello,
I have a problem, i work with web pages, i want to fill labels in one webForm from the information of TextBox in another webForm , how can I do it?
thanks, sharon.
|
|
|
|
|
sharon wrote:
I have a problem, i work with web pages, i want to fill labels in one webForm from the information of TextBox in another webForm , how can I do it?
Usually you would store the data in a session variable if you are not calling the second form from the first and there would possibly be other pages interacted with between them. You could pass the values directly if you did call the second form from the first.
Rocky Moore
|
|
|
|
|
I'm doing a dead-simple text binding:
this._ctlTitle.DataBindings.Add( "Text", this._movie, "Title2" );
This populates the control just fine. But when I change the text in the control, the binding doesn't seem to care. If I get the binding from the DataBindings collection and look at it in the debugger, the private field, "modified", is false. If I set it to true in the debugger and call the PropertyManager method EndCurrentEdit, I see the new value persisted to the data source.
So how do I get that modified field set to true?
|
|
|
|
|
Hey all,
I'm working with the DirectX 9 library, specifically the Managed DirectX part. I'm trying to avoid using their GraphicsForm class as the main render target and such, but I am having a problem with making my Windows Form tell me when it is idle. So here's my question:
How can I have a System.Windows.Forms.Form object call a function when it is idle? The GraphicsForm class has a nice message handler for doing that, but I need to do it using the regular forms. Any way to do it would be much appreciated. Thanks!
Andy Luedke
|
|
|
|
|
Use the Application.Idle event.
It looks like you're a beta tester for DX9 (since I don't see it listed any where for download); MS should have a private forum setup for you to use for asking questions relating to it.
James
Simplicity Rules!
|
|
|
|
|
Just like the MFC source code
I'm amumu, and you?
|
|
|
|
|
Yes, you need to use Anakrino
You can download in here
htpp://www.saurik.com
|
|
|
|
|
Rama Krishna wrote:
Yes, you need to use Anakrino
What does Anakrino do?
Disassemble?
Nish
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Nish - Native CPian wrote:
What does Anakrino do?
Disassemble?
Use it and see
I use it so often that I don't see MSDN docs anymore. I can't survive without it.
|
|
|
|
|
Rama Krishna wrote:
Use it and see
I use it so often that I don't see MSDN docs anymore. I can't survive without it.
Hello Rama
It is an interesting tool indeed. But I really don;t undersyand why you say that it is a replacement for MSDN
Nish
p.s. pardon the typo errors please. I cant be bothered correcting them
Regards,
Nish
Native CPian.
Born and brought up on CP.
With the CP blood in him.
|
|
|
|
|
Nish - Native CPian wrote:
But I really don;t undersyand why you say that it is a replacement for MSDN
I only rarely look at docs for a description of what a class/method/property does anymore. I just see Anakrino. This was the way i did with MFC and esp. ATL.
|
|
|
|
|
If you want to get real down and dirty; you can look at the source to Rotor which is the Shared Source version of .NET meant for FreeBSD.
The source for .NET on Windows machines IS different; though differences aren't pointed out.
James
Simplicity Rules!
|
|
|
|
|
hello,
to get information from the dll ie. the methods,types, parameters i use Reflection. at certain times i have to delete this dll which is usually not a problem. the problem is once i've reloaded a dll and performed some reflection on it, that when i go to delete the dll using FileInfo.Delete() i get an Access is Denied exception. so its as if the dll is still being used or a thread that's still alive or.... this one's got me stumped. maybe there's a better way of reflecting the information from the dll or something.
here's the code starting with the Reflection: pretty straight forward. so i get the dll pass it into an Assembly and there you go. for what i need to do i think its about the easiest least overhead way.
string tempPath = Path.GetTempPath();//Gets the path to the MS tempdir
string strMSTempPath = tempPath.Replace(@"\", @"\\");
string strTempName = strNameSpace + ".dll";
Assembly ass = Assembly.LoadFrom(strMSTempPath + strTempName);
string strObject = strNameSpace + "." + strServiceName;
Type typeDynProxy = ass.GetType(strObject);
MethodInfo[] methodArray = typeDynProxy.GetMethods(BindingFlags.Public|BindingFlags.Instance);
this is how i delete the dll from the directory. nothing fancy.
string tempPath = Path.GetTempPath();
string strTempName = tempDeleteDLL + ".dll";
FileInfo fileInfo = new FileInfo(tempPath + strTempName);
fileInfo.Delete();
throws the Exeption as soon as it executes Delete():
"Access to the Path C:\..\..\ is denied."
normally i can delete the dll. just not after i run the Reflection code above.
any ideas or help would be great.
thanks
Orion
|
|
|
|
|
The problem is that once an assembly is loaded into an AppDomain the assembly isn't unloaded until the AppDomain is unloaded.
An AppDomain is a basic unit of execution; its similar to a process in Win32; but in .NET a single process can host multiple AppDomains.
So what you need to do is create a new AppDomain, then load the assembly into that; the tricky part is you can't have any reference of that assembly in your current AppDomain, otherwise the assembly gets loaded into it too.
I don't have any code laying around for that; but it is something I plan on looking into when I get back from my little vacation
James
Simplicity Rules!
|
|
|
|
|
Thanks James, you guys and this site rules..!!
i figured it was a deeper problem. so bear with me i just need to get this straight before i dive in here. its the reference part that's got me. of course )) if i get this figured out i'll send you the code.
outside of the dll issue, where does the one AppDomain start and end? if i understand it right an application running is made up of many AppDomains (ie. WinForms, Projects..), but the AppDomains are referencing each other within a singular process. OR, is an Application all being combined into a singular AppDomain regardless of whether i create a New AppDomain or not?
the way i have it right now i've got a Windows.Form which is referencing a separate class which obviously is doing all the work, and that's all part of the main App running. so, and correct me if i'm wrong, by your explanation, that class and everything it does gets added to the "Calling" AppDomain (WinForm), and by that logic all WinForms/Components what ever, ends up being combined into a singular AppDomain. Do i have that right?? Or do they remain separate at least to some degree.
so i'm wondering to what degree i need to keep this New AppDomain "isolated".
in the problem i'm having i'm not instantiating the dll or invoking methods, classes or anything like that. i purely need some info from it (it will be later but by that pt i won't have to worry about deleting it).
hope i made sense here.. ))
Thanks.
Orion
|
|
|
|
|
Check out my latest column on AppDomains and dynamic loading:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp05162002.asp
|
|
|
|