Window resizing
-
Hi, I am trying to prevent users from resizing the form window. I have set: this.WindowState = FormWindowState.Maximized; this.FormBorderStyle = FormBorderStyle.FixedSingle; this.ControlBox = false; It prevents user from resizing except that if I doouble-click on the title bar on top, it resizes. Is there a way to prevent this as well? Thanks.
-
Hi, I am trying to prevent users from resizing the form window. I have set: this.WindowState = FormWindowState.Maximized; this.FormBorderStyle = FormBorderStyle.FixedSingle; this.ControlBox = false; It prevents user from resizing except that if I doouble-click on the title bar on top, it resizes. Is there a way to prevent this as well? Thanks.
Hi, if you were to have
if (WindowState==FormWindowState.Normal) WindowState = FormWindowState.Maximized;
within the Form's Resize handler, you probably would get what you want (a Form that is either Maximized or Minimized). And I as a user would probably hate your app and remove it from my system right away. I like an app to remember its window bounds and reuse the same value next time around, and not to dictate how I choose to use my system. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use < PRE > tags for code snippets, it preserves indentation, and improves readability.
-
Hi, I am trying to prevent users from resizing the form window. I have set: this.WindowState = FormWindowState.Maximized; this.FormBorderStyle = FormBorderStyle.FixedSingle; this.ControlBox = false; It prevents user from resizing except that if I doouble-click on the title bar on top, it resizes. Is there a way to prevent this as well? Thanks.
In case someone else has the same issue, this is how I solved it: protected override void WndProc(ref System.Windows.Forms.Message message) { const int WM_SYSCOMMAND = 0x0112; const int SC_MOVE = 0xF010; const int WM_NCDOUBLECLICK = 0x00A3; switch(message.Msg) { case WM_SYSCOMMAND: int command = message.WParam.ToInt32() & 0xfff0; if (command == SC_MOVE) return; break; // Non-client double click case WM_NCDOUBLECLICK: return; } base.WndProc(ref message); }
-
In case someone else has the same issue, this is how I solved it: protected override void WndProc(ref System.Windows.Forms.Message message) { const int WM_SYSCOMMAND = 0x0112; const int SC_MOVE = 0xF010; const int WM_NCDOUBLECLICK = 0x00A3; switch(message.Msg) { case WM_SYSCOMMAND: int command = message.WParam.ToInt32() & 0xfff0; if (command == SC_MOVE) return; break; // Non-client double click case WM_NCDOUBLECLICK: return; } base.WndProc(ref message); }
That may be both unnecessary and insufficient; if the application shows in the task bar, you can right click there and choose "Restore". :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use < PRE > tags for code snippets, it preserves indentation, and improves readability.
-
Hi, if you were to have
if (WindowState==FormWindowState.Normal) WindowState = FormWindowState.Maximized;
within the Form's Resize handler, you probably would get what you want (a Form that is either Maximized or Minimized). And I as a user would probably hate your app and remove it from my system right away. I like an app to remember its window bounds and reuse the same value next time around, and not to dictate how I choose to use my system. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use < PRE > tags for code snippets, it preserves indentation, and improves readability.
I understand it is not user friendly but it is not supposed to be. This is for a kiosk style app and it is the only app running and should always be in maximze state. I would also remove any app from my machine if it dictates how it should be alwyas be displayed.
-
That may be both unnecessary and insufficient; if the application shows in the task bar, you can right click there and choose "Restore". :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use < PRE > tags for code snippets, it preserves indentation, and improves readability.
Thanks Luc. It is a kiosk app and I am actually in the process of finding some way to clamp down on what users can do (disable CTL-ALT-DEL, ALT-TAB, etc., remove task bar, ...) In case anyone knows how to accomplish these, i would really appreciate a sample or pointing me to right direction.
-
Thanks Luc. It is a kiosk app and I am actually in the process of finding some way to clamp down on what users can do (disable CTL-ALT-DEL, ALT-TAB, etc., remove task bar, ...) In case anyone knows how to accomplish these, i would really appreciate a sample or pointing me to right direction.
You should have said so right away. I have no experience with kiosk mode, but the topic pops up regularly around here; the best reply seems to be this one[^]. For more, use CodeProject's message search facility, or Google. :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use < PRE > tags for code snippets, it preserves indentation, and improves readability.