473,396 Members | 1,683 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Form.MinimumSize property doesn't work

I set the MinimumSize property on my form but it doesn't
seem to work. I can still resize the form to any size I
want. What I'm trying to do is prevent the buttons from
vanishing when the form is resized. So I figured if I set
the minimum size it would stop the form from resizing past
the buttons. Works ok in the Designer but not in runtime.
Is there another way to accomplish this?
Nov 15 '05 #1
1 6942
"sandman" <sa*********@yahoo.com> wrote in message
news:02****************************@phx.gbl...
I set the MinimumSize property on my form but it doesn't
seem to work. I can still resize the form to any size I
want. What I'm trying to do is prevent the buttons from
vanishing when the form is resized. So I figured if I set
the minimum size it would stop the form from resizing past
the buttons. Works ok in the Designer but not in runtime.
Is there another way to accomplish this?


Setting MinimumSize has always worked for me. You'll probably have to post
a short but complete program that shows this problem in order to get better
help. For example, below is a short but complete program that works fine.
--
Mike Mayer
http://www.mag37.com/csharp/
mi**@mag37.com
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace ConsoleApplication1
{
public class Form1 : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;

public Form1()
{
InitializeComponent();
}

protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

private void InitializeComponent()
{
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.MinimumSize = new System.Drawing.Size(400, 200);
this.Name = "Form1";
this.Text = "Form1";
}

public static void Main()
{
Application.Run(new Form1());
}

}
}

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John Tighe | last post by:
Changing the max or min size of a form can be in code, but if I do that then it causes build errors in my application. The build error is: Expression is a value and therefore cannot be the target...
5
by: Patrick De Ridder | last post by:
My program produces a number of overviews, for which I use different forms, which are displayed. These forms are displayed at certain positions on the screen. I don't want the user of the program...
3
by: john sutor | last post by:
How can you lock a form so a user cannot resize the form? Hint: the "Locked" property does not work
2
by: Wim | last post by:
I noticed that my program was reacting slow when moving it over the screen. So I went looking for what was causing this. It seems Form.MinimumSize is the culprit. At first I had this.MinimumSize =...
2
by: Damien Sawyer | last post by:
Hi, Can someone recommend the 'best practice' for ensuring that the user doesn't resize a form (MDI child) to be smaller than a given w * h? I've been playing with resetting the size in the...
6
by: John Bowman | last post by:
Hi All, I must be missing something really obvious, so I'd appreciate someone helping me out. I have a simple Windows form that currently only has a title bar (aka the Text Property is set) and...
6
by: Rob | last post by:
I need to create a form that will resize only the verticle size of the Form and not the width. So far I'm partial to the following code. Can someone please elaborate the ??? . . . . Const...
1
by: 1388-2/HB | last post by:
For vb2005. At design time I set the main form's WindoState to Maximized and I disabled the Maximize box. The user can Minimize the application only. When the program launches, the form is...
7
by: Matthew Speed | last post by:
I have a form that I would like to make very small on load. No matter how small I set it the form gets set to 123x34 when it loads. I am free to resize it smaller using my mouse but the initial...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.