Programing

사용자의 양식 크기 조정을 비활성화하려면 어떻게합니까?

crosscheck 2020. 7. 28. 07:55
반응형

사용자의 양식 크기 조정을 비활성화하려면 어떻게합니까?


사용자의 양식 크기 조정을 비활성화하려면 어떻게합니까? 어떤 속성이 사용됩니까?

나는 시도 AutoSize하고 AutoSizeMode.


변경 FormBorderStyle고정 값 중 하나에 : FixedSingle, Fixed3D, FixedDialog또는 FixedToolWindow.

FormBorderStyle속성은 모양 범주에 있습니다.

또는 이것을 확인하십시오

// 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.
form1.ShowDialog();

FormBorderStyle재산을 사용 하여 만드십시오FixedSingle

this.FormBorderStyle = FormBorderStyle.FixedSingle;

FormBorderStyle귀하의 재산 사용Form

this.FormBorderStyle = FormBorderStyle.FixedDialog;

양식의 MaximumSizeMinimumSize속성을 사용 하면 양식 크기가 수정되고 양식의 기본값을 유지하면서 사용자가 양식의 크기를 조정할 수 없습니다 FormBorderStyle.

this.MaximumSize = new Size(XX,YY);
this.MinimumSize = new Size(X,Y);

꽤 오래되었지만 향후 사용자를 위해 항상 이것을 사용합니다.

// lock form
this.MaximumSize = this.Size;
this.MinimumSize = this.Size;

이렇게하면 코드를 변경하지 않고도 Designer에서 양식의 크기를 항상 조정할 수 있습니다.


이 속성을 변경하고 디자인 타임에 시도하십시오

FormBorderStyle = FormBorderStyle.FixedDialog;


최대 크기, 최소 크기를 설정하고 창의 그리퍼 아이콘을 제거합니다.

속성 설정 (MaximumSize, MinimumSize, SizeGripStyle) :

this.MaximumSize = new System.Drawing.Size(500, 550);
this.MinimumSize = new System.Drawing.Size(500, 550);
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;

참고 URL : https://stackoverflow.com/questions/5416380/how-do-i-disable-form-resizing-for-users

반응형