Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable a form resize at design time?

Tags:

c#

winforms

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?

I need it at design-time

like image 959
user366312 Avatar asked Dec 01 '22 05:12

user366312


2 Answers

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();
        }
    }
}
like image 70
Adel Hazzah Avatar answered Dec 04 '22 20:12

Adel Hazzah


i used

this.FormBorderStyle = FormBorderStyle.FixedDialog;

this make window form as like dialogBox. so dialog boxes are not resizable by user.

like image 41
paraguma Avatar answered Dec 04 '22 20:12

paraguma