Form.MinimumSize property doesn't work

  • Thread starter Thread starter sandman
  • Start date Start date
S

sandman

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?
 
sandman said:
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/
(e-mail address removed)


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());
}

}
}
 
Back
Top