Results 1 to 7 of 7

Thread: [RESOLVED] Disable maximize on double click titlebar

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2006
    Location
    MI
    Posts
    1,965

    Resolved [RESOLVED] Disable maximize on double click titlebar

    How can I disable the form maximizing when double clicking the titlebar?

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Disable maximize on double click titlebar

    try this:

    vb Code:
    1. Public Class Form1
    2.  
    3.     Public Const WM_NCLBUTTONDBLCLK As Integer = &HA3
    4.  
    5.     Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
    6.         If m.Msg = WM_NCLBUTTONDBLCLK Then Return
    7.         MyBase.WndProc(m)
    8.     End Sub
    9.  
    10. End Class

  3. #3
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Disable maximize on double click titlebar

    Quote Originally Posted by nbrege View Post
    How can I disable the form maximizing when double clicking the titlebar?
    If you set the form's MaximizeBox property to False, it not only disables the clicking of the button but it also ignores the double clicking of the title bar too.
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2006
    Location
    MI
    Posts
    1,965

    Re: Disable maximize on double click titlebar

    Both solutions work ... I forgot about the MaximizeBox property. Thanks guys...

  5. #5
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: [RESOLVED] Disable maximize on double click titlebar

    I just remembered, the one thing I forgot to mention was that Logitech mice can get around it my sending the Maximise (not double click) command directly to windows app's (forms) so setting the MaximiseBox to False prevents it other than Logitech. .paul. could probably figure out the m.Msg code for that, but I just use the Resize event of the form and if .WindowState = Maximized then I set it back to normal (I still disable the Maximize button on the form though)
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

  6. #6
    New Member
    Join Date
    Oct 2013
    Posts
    4

    Re: [RESOLVED] Disable maximize on double click titlebar

    @.paul: Kudos! +1

  7. #7
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: [RESOLVED] Disable maximize on double click titlebar

    Quote Originally Posted by M.ServerG View Post
    @.paul: Kudos! +1
    thanks for the Kudos, keep it up.
    it really would be +1 if you had 20+ posts, but thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width