all groups > vb.net > january 2008 >
You're in the

vb.net

group:

Prevent Form Un-maximizing when titlebar is double-clicked.


Prevent Form Un-maximizing when titlebar is double-clicked. Engineerik
1/31/2008 7:04:03 AM
vb.net:
I have a form which is maximized when I show it.
The form maximize button is not enabled so cannot be used to un-maximize the
form. However, if a double-click is done on the form titlebar the form
resizes to its unmaximized size.
I know I can change the unmaximized size to be equal to the maximized size
but is there a way to prevent the un-maximize that occurs when the form
titlebar is doubleclicked?

Re: Prevent Form Un-maximizing when titlebar is double-clicked. Engineerik
1/31/2008 9:57:01 AM

[quoted text, click to view]

This does the trick:

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Const WM_NCLBUTTONDBLCLK As Int32 = &HA3
If m.Msg = WM_NCLBUTTONDBLCLK Then
Exit Sub
End If
MyBase.WndProc(m)
End Sub


Thanks,
Re: Prevent Form Un-maximizing when titlebar is double-clicked. Herfried K. Wagner [MVP]
1/31/2008 4:22:07 PM
"Engineerik" <Engineerik@discussions.microsoft.com> schrieb:
[quoted text, click to view]

You may want to listen for the 'WM_NCLBUTTONDBLCLK' message in your form's
'WndProc' and "eat" this message if the form's 'WindowState' property is set
to 'Maximized'.

\\\
Private Const WM_NCLBUTTONDBLCLK As Int32 = &HA3
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Re: Prevent Form Un-maximizing when titlebar is double-clicked. SurturZ
2/3/2008 8:13:05 PM
If you don't mind losing the form title bar, then set Form.ControlBox=False
and Form.Text=""

--
David Streeter
Synchrotech Software
Sydney Australia


[quoted text, click to view]
AddThis Social Bookmark Button