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?
Thx
Printable View
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?
Thx
And it moves when maximized!!!
So what do you want to do exactly ?
Not to move, not to resize, maximized.
Simply do this with having your form set to maximized for WindowState . This solves resizing and moving the form problems.
VB Code:
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize Me.WindowState = FormWindowState.Maximized End Sub
No no... I did it. The form moves, and if I doubleclick on the titlebar it resizes to the design size...
This is what I tried and worked well . I'm sure you missed something . try it out !
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.
Thx
Xmas.
Is your Windows task bar set to be On Top of other windows ?
Yes, it is.
Now , this should solve these problems perfectly I guess .Quote:
Originally posted by Xmas79
Not to move, not to resize, maximized.
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 ;)
Why you all have an answer for every question :confused: Wait for me!!! One day... :D
Yeah Tygur , that was easier . I was a little bit lost in these messages . Thanks for making me look at that .