I have a form with FormBorderStyle=FixedSingle, and Maximized=true.
First of all, it goes over the taskbar, and I don't like, then when I doubleclick on the title of the window it resizes to design size!!!!
What to do?
Yes, in your example it works... it resolves form resize, but not to move... I found two bugs: when you have the maximizebox property to false, the form when maximized will go over the taskbar, and it moves!. 2nd: It's not possible to avoid the resizing of the form to the design size, until you use the code you wrote. Maybe with API, godd old VB6 could catch windows messages... Don't know how to do this in VB.NET.
Pirate, I checked out your code. It looks like you're basically trying to make the form ignore all clicks to the title bar or any of its buttons, but it's not quite working, hence the handling if the Closing and Resize events.
The magical message you're looking to block is actually WM_NCHITTEST. That WndProc override can just look like this:
VB Code:
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = WM_NCHITTEST Then
Exit Sub
End If
MyBase.WndProc(m)
End Sub
And the only constant declaration you need is this:
VB Code:
Const WM_NCHITTEST = &H84
You no longer need to handle the Closing or Resize events after that. This takes care of the flickering you get when you double-click on the titlebar and makes it look a whole lot more natural. It also means that you no longer have to use End to close the app (technically, it wasn't absolutely necessary before, but anyway...).
If you want to know how to let any particular kinds of clicks through, such as maybe minimize, let me know. Or you can figure it out. The information is out there, after all