Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
 
 
 
500MB 27GB Web Hosting - $9.95/Month
 
 
 
 
 
Old Pages
 
Old Index
Site Map
What's New
 
Books
How To
Tips & Tricks
Tutorials
Stories
Performance
Essays
Links
Q & A
New in VB6
Free Stuff
Pictures
 
 
 
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-2003 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated