Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleLet the user minimize, maximize, and restore a form, but not resize it in VB .NET
Keywordssubclass, WindowProc, messages, VB.NET, NET, resize, minimize, maximize
CategoriesTips and Tricks, API, VB.NET
 
Subclass and look for the WM_SYSCOMMAND message. If the wParam parameter is SC_SIZE, ignore the message. Otherwise call the base class's WndProc method to process the message normally.
 
Protected Overrides Sub WndProc(ByRef m As _
    System.Windows.Forms.Message)
    Const WM_SYSCOMMAND As Long = &H112
    Const SC_SIZE As Long = &HF000

    ' See if this is WM_SYSCOMMAND.
    If m.Msg = WM_SYSCOMMAND Then
        ' Ignore SC_SIZE commands.
        If (m.WParam.ToInt32 And &HFFF0&) = SC_SIZE Then _
            Exit Sub
    End If

    MyBase.WndProc(m)
End Sub
 
See also Subclass to read Windows messages in VB .NET.
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated