May 12th, 2010

You are currently browsing the articles from Information City written on May 12th, 2010.

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 1 comment.
Read more articles on Knowledge Base and Programming.