maximized form

G

Guest

I want to have an application window be always maximized (or minimized) but
never in normal state. If I take away the maximize button in the form and
start the application in maximized mode the user can still double click on
the title bar to unmaximize it, but never maximize it afterwards. Is there a
way to solve this?
 
E

eusebiu

Try this:
-disable maximize button;
-set the WindowState to Normal;
-set StartPosition to CenterScreen;
-in Form constructor, after InitializeComponent(); do this :
Screen s = Screen.AllScreens[0];
this.Size = new Size(s.WorkingArea.Width + 1,
s.WorkingArea.Height + 1);
 
G

Guest

Unfortunately it doesn't. This way the window is still movable and it's not
in fullscreen mode so if someone changes the screen resolution (to adapt to a
beamer from a notebook) the window will not adapt its content to the new
screen resolution ...
 
P

Peter Duniho

I want to have an application window be always maximized (or minimized)
but
never in normal state. If I take away the maximize button in the form and
start the application in maximized mode the user can still double click
on
the title bar to unmaximize it, but never maximize it afterwards. Is
there a
way to solve this?

I haven't tried this, but you may be able to address the issue by handling
the WM_SYSCOMMAND message in the WndProc method of your main application
form class. Watch for the SC_RESTORE message, and don't call the base
WndProc method when it shows up.

It's my expectation that when the user double-clicks on the title bar,
this is the message that's sent if the window is already maximized, and so
ignoring it will prevent the window from being un-maximized.

Pete
 
G

Guest

Thanks, that was the hint I was looking for. I wasn't aware that there is a
wndProc method in C#, too. I'm coming from C++ and was hoping, I would never
have to deal with messages outside of some kind of an editor. Guess, I was
terribly wrong here ...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top