DoubleClick event not firing on MdiContainer form?

J

Joergen Bech

In VB.Net 2005:

1. Create new application
2. Select Properties for Form1
3. Set IsMdiContainer = True
4. In the code, write

Public Class Form1
Private Sub Form1_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.DoubleClick
MsgBox("Test")
End Sub
End Class

Run the project. Double-click the form.

Nothing happens?

If I override WndProc to spy on the messages like this

Protected Overrides Sub WndProc(ByRef m As
System.Windows.Forms.Message)
Debug.WriteLine(m.Msg.ToString)
MyBase.WndProc(m)
End Sub

the results are quite different from what I get when I set
IsMdiContainer = False (in which case everything works
again).

Anyone who can shed some light on what the problem is?
Something like this used to work fine in VB6.

Regards,

Joergen Bech
 
A

Armin Zingler

Joergen Bech said:
In VB.Net 2005:

1. Create new application
2. Select Properties for Form1
3. Set IsMdiContainer = True
4. In the code, write

Public Class Form1
Private Sub Form1_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.DoubleClick
MsgBox("Test")
End Sub
End Class

Run the project. Double-click the form.

Nothing happens?

That's by design. If it's an MDI container, the empty area is filled by
a System.Windows.Forms.MdiClient control. That's the one that receives
the DoubleClick, though, only if the corresponding control styles are
set.

The client area is considered a container only for _usable_
controls/windows.


Armin
 
J

Joergen Bech

That's by design. If it's an MDI container, the empty area is filled by
a System.Windows.Forms.MdiClient control. That's the one that receives
the DoubleClick, though, only if the corresponding control styles are
set.

The client area is considered a container only for _usable_
controls/windows.


Armin

Nonetheless, this was possible in VB6 and is what I need.

In Photoshop, double-clicking the empty MdiClient area brings
up an Open File dialog and it is the same functionality I want
to implement, regardless of general conventions.

So the question is, how do I hook into this event in .Net?

Regards,

Joergen Bech
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top