【发布时间】:2011-01-31 19:36:18
【问题描述】:
我想在屏幕中心显示我的 WinApp,所以我将 StartPosition 属性设置为 CenterScreen 但窗口没有显示在屏幕中心。
它有什么问题?我错过了什么吗?
附注:
我从一个主窗口和一个按钮显示窗口。
编辑:
我用来显示窗口的代码。
Form_CO form_CO = new Form_CO();
void button_CO_Click(object sender, EventArgs e)
{
try
{
//StaticVariables.Form_CO_IsShown is to prevent opening the same multiple windows
if (!StaticVariables.Form_CO_IsShown)
{
form_CO = new Form_CO();
form_CO.Show();
StaticVariables.Form_CO_IsShown = true;
}
else
{
form_CO.WindowState = FormWindowState.Normal;
form_CO.Activate();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
【问题讨论】:
-
很可能,你做错了什么。
标签: c# visual-studio-2008 winapp