In my application I am deriving all my forms from a common BaseForm.
Now I need to disable the resizing in the BaseForm so that derived forms are not resizable at design-time.
How to achieve that?
In my application I am deriving all my forms from a common BaseForm.
Now I need to disable the resizing in the BaseForm so that derived forms are not resizable at design-time.
How to achieve that?
Use the following:
this.FormBorderStyle = FormBorderStyle.FixedSingle;
If you go into design view and look in the form's properties menu, there is a Locked
property, which disables resizing of the form.
EDIT
Try setting the MaximumSize
and MinimumSize
properties to the same value.
This seems to work:
[BaseForm.cs]
namespace WindowsFormsApplication1
{
using System.Windows.Forms;
public partial class BaseForm : Form
{
public BaseForm()
{
InitializeComponent();
this.MaximumSize = this.MinimumSize = this.Size;
}
}
}
[DerivedForm.cs]
namespace WindowsFormsApplication1
{
public partial class DerivedForm : WindowsFormsApplication1.BaseForm
{
public DerivedForm()
{
InitializeComponent();
}
}
}