Disable (double click) Windows title bar sizing

While developing one of the apps. for demo on a touchscreen device, it came to surprise on the application windows sizing function. I have set the formborderstyle to fixedsingle in hope to disable the application from resize but it seems that it was able to shrink/un-maximize from maximized application. I tried playing around with the values in the window properties but to no avail.

I search around the net and found an interesting code snippet posted on Microsoft community newsgroup (idea originates from the MVP, Herfried K. Wagner):

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

Having that codes in the winforms disabled the window resizing on double clicking of the title bar. Great one!

Keywords:

Written by admin on May 12th, 2010 with 1 comment.
Read more articles on Knowledge Base and Programming.

Related articles

1 comment

Read the comments left by other users below, or:

Get your own gravatar by visiting gravatar.com Dennis C
#1. June 9th, 2011, at 5:51 AM.

Thanks, good code!
I was looking for the same solve.

Leave your comment...

If you want to leave your comment on this article, simply fill out the next form:




You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> .