How to disable form resizing during development?

In my application, I retrieve all my forms from a generic BaseForm.

Now I need to disable resizing in BaseForm so that derived forms do not change during development.

How to do it?

I need this during development

+4
source share
4 answers

It works:

[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(); } } } 
+10
source

I used

 this.FormBorderStyle = FormBorderStyle.FixedDialog; 

this makes the window form look like a dialogBox. therefore, dialog boxes are not modified by the user.

+4
source

Use the following:

 this.FormBorderStyle = FormBorderStyle.FixedSingle; 
+3
source

If you go into the design view and look in the form's properties menu, there is a Locked property that disables resizing the form.

EDIT

Try setting the MaximumSize and MinimumSize to the same value.

+2
source

Source: https://habr.com/ru/post/1315266/


All Articles