Catch Title bar double click

M

Marty

Hi,

I stuck on basic thing today...

How can I caych the double click event when it is done on the title bar
of a form. I just want my form to be expanded or shrinked when the user
dbl-click.

Thanks,
Marty
 
H

Herfried K. Wagner [MVP]

Marty said:
How can I caych the double click event when it is done on the title bar
of a form. I just want my form to be expanded or shrinked when the user
dbl-click.

\\\
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Static Expanded As Boolean = True
Static Height As Integer
Const WM_NCLBUTTONDBLCLK As Int32 = &HA3
If m.Msg = WM_NCLBUTTONDBLCLK Then
If Expanded Then
Height = Me.Height
Me.Height = 0
Else
Me.Height = Height
End If
Expanded = Not Expanded
End If
MyBase.WndProc(m)
End Sub
///
 
M

Marty

Thank you, exactly what I needed.
Marty
\\\
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Static Expanded As Boolean = True
Static Height As Integer
Const WM_NCLBUTTONDBLCLK As Int32 = &HA3
If m.Msg = WM_NCLBUTTONDBLCLK Then
If Expanded Then
Height = Me.Height
Me.Height = 0
Else
Me.Height = Height
End If
Expanded = Not Expanded
End If
MyBase.WndProc(m)
End Sub
///
 

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