4
Contributors
7
Replies
8
Views
6 Years
Discussion Span
Last Post by brokenarrow_vip
1

Why do you want to use Lock?
To prevent user can resize form?
If so, you use form`s properties like: MaximizeBox, MinimizeBox, like:

//on form1:
Form2 form2 =new Forms();
form2.MaximizeBox = false;
form2.MinimizeBox = false;

Or is there anything else you want to use Lock?

Edited by Mitja Bonca: n/a

Votes + Comments
thanks! got it
0

Try this:

private void button1_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2();
            form2.FormBorderStyle = FormBorderStyle.Fixed3D;
            form2.MaximizeBox = false;
            form2.MinimizeBox = false;
            form2.Show(this);
        }
1

The Locked property is a design type only property that only affects if you can move/resize the form inside the designer. To prevent resizing set FormBorderStyle to one of FormBorderStyle.Fixed3D, FormBorderStyle.FixedDialog, FormBorderStyle.Single, FormBorderStyle.ToolWindow. If you want to prevent min/max, then set MaximizeBox to false and MinimizeBox to false.

Votes + Comments
thanks! got it
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.