Sunday, July 10, 2011

FixedToolWindow still can be resized !!

Hello,

Have you tried setting the FormBorderStyle to a new form to FixedToolWindow ,As the name implies the form should not be able to get resized ,Maximized,Minimized.
Unfurtunately it can get resized by double clicking it's titlebar !!
Some say it is a bug in VS

AnyWay to overcome this bug just copy and paste this piece of code in your form.

Private Shared WM_SYSCOMMAND As Integer = &H112
    Private Shared SC_MAXIMIZE As Integer = &HF030
    Protected Overrides Sub WndProc(ByRef m As Message)
        If m.Msg = WM_SYSCOMMAND AndAlso (m.WParam.ToInt32() And &HFFF0) = SC_MAXIMIZE Then
            Return
        End If
        MyBase.WndProc(m)
    End Sub

That's all

No comments:

Post a Comment