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.
Related
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.
In my C# application I have set the form border to Fixed3D, as I don't want to re-size it. However, the arrow on the bottom right of the form still appears for re-size even though it doesn't allow re-sizing.
How do I hide that arrow?
My best guess is you have a StatusStrip on the form. If so, set the SizingGrip property to false.
What you are looking for is:
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
or it can be set in form designer property window.
Correction:
On the form, setting the Border to Fixed3D will remove the sizing grip from the form... UNLESS you have a status strip on the form with a SizingGrip set to true.
Solution: insure that your form's statusStrip1.SizingGrip = false;
See: http://msdn.microsoft.com/en-us/library/system.windows.forms.form.sizegripstyle.aspx
there should be a property of the form called ShowSizeGrip, just set it to False.
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 want that the user shouldn't be able to resize the window form. I was able to disable the maximize button but wasn't able to find any property to disable resizing.
Any help?
You need to set the FormBorderStyle property to one of the fixed values.
Change the FormBorderStyle to FixedSingle. Also set MinimizeBox and MaximizeBox to False. Even double clicking the title will not maximize the form.
Assuming you are talking about a WinForms form, you can disable resizing by changing the FormBorderStyle property to one of the Fixed values, such as FixedSingle. There are also MaximumSize and MinimumSize properties that may be set if you want to allow some, but not total, resizing.
If you are talking about a WPF application, then you can set the ResizeMode property to NoResize, or you can set the MaxHeight, MaxWidth, MinHeight, and MinWidth properties.
As noted in the comments for the question, make sure you have a good reason to disable resizing. Most of the time, there are better alternatives that allow resizing (especially in WPF).
Set MaximumSize and MinimumSize to the current form size
this.MaximumSize = new System.Drawing.Size(x, y);
this.MinimumSize = new System.Drawing.Size(x, y);
Change the frame/border type to a non-resizeable type.
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);