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!

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

Related articles

No comments

There are still no comments on this article.

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> .