我们有以下代码:的WinForms - 错误的窗体大小
private void MainForm_Shown(object sender, EventArgs e)
{
RepositionForm();
}
private void RepositionForm()
{
Rectangle rect = Screen.PrimaryScreen.WorkingArea;
this.Width = 100;
this.Height = 117;
this.TopMost = true;
this.Left = rect.Width - this.Width - 1;
this.Top = rect.Height - this.Height - 1;
}
当我们推出从Visual Studio应用程序 - 形式示出正确的尺寸:100x117。 但是,当我们通过启动EXE文件启动项目时,表单大小为106x127。
The MinimumSize, MaximumSize and Size properties are set to 100x117.
WindowsState = Minimized
ShowIcon = False
ShowInTaskbar = False
Topmost = True
MinimizeBox - False
MaximizeBox = False
FormBorderSize = FixedDialog
ControlBox = True
这怎么可能发生,即应用程序的启动方式有什么区别?
感谢
完全删除窗口边框,看看你是否得到相同的行为。 – 2013-02-28 13:19:54
你是否在VS的调试模式下启动它? – 2013-02-28 13:20:25
@ bash.d:是的,在调试模式下 – 2013-02-28 13:28:27