[英]Windows Form Cannot be Displayed CenterScreen
I used this code for the secondary form to act / be like mdi, this is windows form C#我将此代码用于辅助表单的行为/类似于 mdi,这是 Windows 表单 C#
frmFontLoad fontLoad = new frmFontLoad();
fontLoad.TopLevel = false;
Controls.Add(fontLoad);
fontLoad.Show();
fontLoad.BringToFront();
but the result then the form was loaded is like this refer to screenshot:但结果然后表单被加载是这样的参考截图:
Code on Form Load:表单加载代码:
private void frmLabelPNInput_Load(object sender, EventArgs e)
{
this.StartPosition = FormStartPosition.CenterScreen;
Printer_SerialPort = new SerialPort(ConfigurationManager.AppSettings["Printer_com_port"]);
btnOk.Enabled = false;
}
how can i make this secondary form to be displayed at the center?我怎样才能使这个辅助表单显示在中心?
frmProgress progress = new frmProgress();
progress.Left = (this.ClientSize.Width - progress.Width) / 2;
progress.Top = (this.ClientSize.Height - progress.Height) / 2;
This solved my problem, thanks这解决了我的问题,谢谢
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.