|
It can be done, but it's not obvious how to do it.
Read this[^] article on MSDN and it'll show you exactly how to do it. The samples are in VB.NET, but it's easy to convert to C#.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thats really cool. I am using .NET for 4 years now but never knew it.
Thanks.
|
|
|
|
|
I think this just solved an unrelated problem I had, with a MDI Child that needed to show a "child" form of its own. It was acting really strange...
Anyway, I think this gives me an idea of what to try, and thanks for the link, very interesting.
Sue
|
|
|
|
|
Yeah, MDI Parent's can only have one set of children and MDI Children are not allowed to have children of their own. The onyl way around this limitation (imposed by Windows, not the .NET Framework) is to treat a form as a control.
Since the Form class derives from Control,
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.ScrollableControl
System.Windows.Forms.ContainerControl
System.Windows.Forms.Form
a Form can be hosted in any container that can accept a System.Windows.Forms.Control object.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hai Friends,
I had one doubt.Why interface in c#.net doesn't support fields?
But Java interface supprots fields.How it is possible in java?
Any body knows the answer mail me.
Thnaks & Regards,
Manimala
|
|
|
|
|
Interfaces supports fields in java? That is strange.
Strictly oop speaking, fields should not be public at all, but only be accessible through properties. An interface only defines public members, so it should not contain fields.
Furthermore, specifying fields in an interface would force you to implement them in exactly that way, which is exactly opposed to the purpose of interfaces.
Also, specifying fields in an interface could make interfaces collide. If two interfaces specify the same field names, you could not inherit both interfaces in a class.
---
b { font-weight: normal; }
|
|
|
|
|
|
I'm searching a way to make a Form transparent to clicks. I mean that if the Form is clicked, the click will not be stopped, but it has to be sent behind the Form, to the next window or to the desktop. This behavior must be also used for mousedown, mouseup, and so on.
Please help...
Thanks
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi.
[ENG] Tozzi is right: Gaia is getting rid of us.
|
|
|
|
|
Question: What is the Opacity of your form. Can you see the items behind the form.
|
|
|
|
|
I mean at ANY opacity.
I know that with the opacity = 0, the form behaves like it wouldn't exists.
Do you have any idea?
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi.
[ENG] Tozzi is right: Gaia is getting rid of us.
|
|
|
|
|
There is no direct way to do it. But there is a hack
using System.Runtime.InteropServices;
public class Form1 : System.Windows.Forms.Form
{
........implementation............
private bool FormMouseDown=false;
private void Form1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (FormMouseDown==true) { return; }
FormMouseDown = true;
this.Visible = false;
SendDoubleClick();
Thread.Sleep(250);
this.Visible = true;
}
private void Form1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
FormMouseDown=false;
}
[DllImport("user32.dll")]
private static extern void mouse_event(UInt32 dwFlags,UInt32 dx,UInt32 dy,UInt32 dwData,IntPtr dwExtraInfo);
private const UInt32 MouseEventLeftDown = 0x0002;
private const UInt32 MouseEventLeftUp = 0x0004;
public static void SendDoubleClick()
{
mouse_event(MouseEventLeftDown, 0, 0, 0, new System.IntPtr());
mouse_event(MouseEventLeftUp, 0, 0, 0, new System.IntPtr());
mouse_event(MouseEventLeftDown, 0, 0, 0, new System.IntPtr());
mouse_event(MouseEventLeftUp, 0, 0, 0, new System.IntPtr());
}
}
|
|
|
|
|
Very interesting...
But I've got a question: during the Form1_MouseDown method, the form will hide for a while. I'd like to avoid this.
I've another idea:
if you can determine the window behind your window (I mean the IntPtr), you can use a method (SendMessage, SendInput) to send the click.
Any suggestion?
Thanks however for the help.
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi.
[ENG] Tozzi is right: Gaia is getting rid of us.
|
|
|
|
|
|
but my form will be hidden during the procedure. this is not very good...
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi.
[ENG] Tozzi is right: Gaia is getting rid of us.
|
|
|
|
|
Give this a try it overrides CreateParams, there is code in c# and vb.
|
|
|
|
|
After a brief reading, I think that could be the solution.
Thank you very much
[ITA] Tozzi ha ragione: Gaia si sta liberando di noi.
[ENG] Tozzi is right: Gaia is getting rid of us.
|
|
|
|
|
hi all,
must be simple but i could not figure it out.
how can i open a file providing a relative path? the file i want to open is in the root folder of the project together with the source files.
will really appreciate.
best wishes
rnv
|
|
|
|
|
Use Server.MapPath() to convert a virtual address to a physical address.
---
b { font-weight: normal; }
|
|
|
|
|
thanks.. but can it also be used with normal class file? my application is not webbased and just a simple class.
regards,
rnv
|
|
|
|
|
|
|
ooops
hi thanks a lot for the answer but i have another question.
when i compile my applciation it creates 'exe' file in 'bin/debug'. how do i specify that it should copy other necessary files as well?
regads,
rnv
|
|
|
|
|
too late....
I get it you are using VS.NET?
Personally I have VS2005 here and I can't be bothering launching VS2003, so here is how I do with 2005.
Project property => Build event
the you could type a few batch command in the appropriate box, like:
"copy C:\resourcedir\* $TargetPath"
I'm not sure this was available to C# project in VS2003....
|
|
|
|
|
|
I want to output data to the console from a button click on my WinForms application.
This is what I tried but with no call to the function aTest() was made.
Process myProcess = new Process();<br />
myProcess.StartInfo.FileName = "cmd";<br />
myProcess.StartInfo.Arguments = "aTest()";<br />
myProcess.StartInfo.UseShellExecute = true;<br />
myProcess.Start();<br />
Thanks
Kash
|
|
|
|