I already set this.WindowState = FormWindowState.Maximized; and everything looks ok but the Windows open-window icons (such as my browser at the bottom of the page) is still visible.
How to make it invisible?
I just figured out the answer
TopMost must be set to true together with FormBorderStyle = FormBorderStyle.None and Bounds = Screen.PrimaryScreen.Bounds.
Related
I am trying to ENABLE resizing of my windows form, because the option of dragging the window into a bigger or smaller window should be available for the user. I have set my FormBorderStyle = Sizable and tried to set max and MinimumSize like this:
this.MaximumSize = new System.Drawing.Size(1680, 1050);
this.MinimumSize = new System.Drawing.Size(995, 765);
before the max and minimumsize was set to be 0,0. But it still doesnt work.
I have one form as a shell for 3 user controls that are inserted into the "shell form". Can this be effecting the resizing abillity ?
Make sure that you haven't set the MaximumSize and MinimumSize Layout Properties.
I had set my form to be a MDI container. After setting my IsMdiContainer to be false i was avble to resize my form.
I am working on an application that has a full screen mode. When the full screen button/key is pressed the application should take up the entire screen i.e. the windows taskbar also disappears.
this.Window= WindowState.Maximized;
this.Window= WindowStyle.None;
this.Fullscreen = true;
When I first start the application my fullscreen mode works as planned and the windows taskbar disappears. The problem is when I resize the window. After any resizing the full screen mode no longer takes up the entire screen. The windows taskbar is still there. It is not reasonable for me to disable window resizing (although that does solve the problem).
It was my understanding that WindowStyle.None removed the taskbar (it does at first). Does anyone know if resizing the window changes something that stops the WindowStyle.None from doing what it does upon first starting up.
EDIT:
I am using a viewbox to scale my content to fullscreen and the stretch of the viewbox in full screen mode is set to Fill
Try applying the WindowStyle first (before WindowState). That fixed it for me.
Edit: I also noticed that this doesn't work when the window is already maximized. Try this:
this.WindowState = WindowState.Normal;
this.WindowStyle = WindowStyle.None;
this.WindowState = WindowState.Maximized;
Instead of using WindowState
use SystemParameters
In your Window's constructor set the width and height
this.Width=SystemParameters.FullPrimaryScreenWidth;
this.Height=SystemParameters.FullPrimaryScreenHeight;
You can also have a look here
I have recently written an application for my daughter, which is a kid-free zone where she has all unnecessary key presses ignored (windows key, Esc etc) but the problem I am having is that when I use the following code:
targetForm.WindowState = FormWindowState.Maximized;
targetForm.FormBorderStyle = FormBorderStyle.None;
targetForm.TopMost = true;
I am able to HIDE the taskbar, but it is not truly overlayed. When I move the mouse to where the taskbar would be, and click, it pops up, also, using this code and running external applications withing my windows form, I am left with this windows form keeping itself on top.
If anyone could help me with a proper way to display my windows form as a true fullscreen application, and be able to run external applications from within the form and have them prioritize themselves on top, that would be greatly appreciated.
In case you missed it, I am using VS2010, C# and winforms.
Thanks in advance!
The proper way to make a full-screen app is to just put something like Bounds = Screen.PrimaryScreen.Bounds; in your main form. Then when your app has focus it will cover the task bar.
You also probably want FormBorderStyle = FormBorderStyle.None;
The order of the performed actions is incorrect.
You should first hide the border (FormBorderStyle=None), and then set the window state to maximized. You even don't have to set TopMost to true.
How do I maximize a window programmatically so that it cannot be resized once it
reaches the maximized state (for example, maximize Internet Explorer and see it)?
I set FormWindowState property as
this.WindowState = FormWindowState.Maximized;
this.MaximizedBounds = (x,y);
but it doesn't work. How do I do this?
The window I want to maximize is a window in my application.
When your form is maximized, set its minimum size = max size, so user cannot resize it.
this.WindowState = FormWindowState.Maximized;
this.MinimumSize = this.Size;
this.MaximumSize = this.Size;
You were close... after your code of
WindowState = FormWindowState.Maximized;
THEN, set the form's min/max size capacity to the value once its sized out.
MinimumSize = this.Size;
MaximumSize = this.Size;
To stop the window being resizeable once you've maximised it you need to change the FormBorderStyle from Sizable to one of the fixed constants:
FixedSingle
Fixed3D
FixedDialog
From the MSDN Page Remarks section:
The border style of the form determines how the outer edge of the form appears. In addition to changing the border display for a form, certain border styles prevent the form from being sized. For example, the FormBorderStyle.FixedDialog border style changes the border of the form to that of a dialog box and prevents the form from being resized. The border style can also affect the size or availability of the caption bar section of a form.
It will change the appearance of the form if you pick Fixed3D for example, and you'll probably have to do some work if you want the form to restore to non-maximised and be resizeable again.
Change the property WindowState to System.Windows.Forms.FormWindowState.Maximized, in some cases if the older answers doesn't works.
So the window will be maximized, and the other parts are in the other answers.
To programmatically maximize the windowstate you can use:
this.WindowState = FormWindowState.Maximized;
this.MaximizeBox = false;
I'm working with windows forms with c#. I've set a property maximizebox = false to my form. But when i click on form it is getting maximized. How can i prevent it?
Note: If i set my form border style is none it is not working. In the other cases it is working fine
Thanks in advance
nagu
Just because you set the maximize box to false does not mean that the form cannot be maximized. It just means that your form hides that particular button.
You can stil max a form by double-clicking the title area, or from within the code itself.
If you want to avoid people resizing you form, set MaximumSize and MinimumSize to the same values, like this:
this.MaximumSize = new System.Drawing.Size(400, 400);
this.MinimumSize = new System.Drawing.Size(400, 400);