PDA

View Full Version : جلوگیری از کوچک شدن فرم با کلیک کردن روی ان از حالت ماکزیمم



saeedhushmand
دوشنبه 09 آبان 1390, 19:16 عصر
من فرمم به حالت ماکزیمم سایز در اوردم ولی وقتی double click می کنم فرمم کوچک می شه(سایزی که هست در می یاد) باید چه کار کنم تا فرمم با کلیک کردن روی ان تغییر اندازه نده

BEHZADnr
دوشنبه 09 آبان 1390, 19:25 عصر
سلام دوست عزیز
خاصیت MaximizeBox فرم را روی false قرار دهید
یا کد زیر را در Form Load قرار دهید
this.MaximizeBox = false;
موفق باشی

shozdeh
دوشنبه 09 آبان 1390, 19:37 عصر
سلام
برای این کار از کد زیر استفاده کن. فکر نکنم راه دیگه ای داشته باشه...

private void Form1_Resize(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Maximized;
}

البته باید قبلش:

// Define the border style of the form to a dialog box.
form1.FormBorderStyle = FormBorderStyle.FixedDialog;
// Set the MaximizeBox to false to remove the maximize box.
form1.MaximizeBox = false;
// Set the MinimizeBox to false to remove the minimize box.
form1.MinimizeBox = false;
// Set the start position of the form to the center of the screen.
form1.StartPosition = FormStartPosition.CenterScreen;
// Display the form as a modal dialog box.