天天看点

c# windowsmobile开发技巧

(1)如何构造全屏窗体      
this.WindowState = FormWindowState.Maximized;
this.FormBorderStyle = FormBorderStyle.None;
this.ControlBox = false;
this.Menu = null;      
(2)如何将一个窗体放在屏幕中央?

要显示一个非全屏窗体,请确保窗体的 FormBorderStyle 属性设置为 FormBorderStyle.None。要使窗体位于中央,请将以下代码添加到窗体的 FormLoad 事件处理程序中:将 FormBorderStyle 设置为 FormBorderStyle.None,然后

Rectangle screen = Screen.PrimaryScreen.Bounds;

this.Location = new Point((screen.Width - this.Width) / 2,

  (screen.Height - this.Height ) / 2);