DoubleClick event not firing on MdiContainer form?

  • Thread starter Thread starter Joergen Bech
  • Start date Start date
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
 
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
 
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
 
Back
Top