kenlistian

勤学多思

  IT博客 :: 首页 :: 新随笔 ::  :: 聚合  :: 管理 ::
  412 随笔 :: 0 文章 :: 23 评论 :: 0 Trackbacks

 

1.直接调用主屏宽度,高度

System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width//显示器的宽度
System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height//显示器高度

 

2.

Point pt;
Rectangle rect = System.Windows.Forms.Screen.GetBounds(pt);

 

3.

//在屏幕的右下角显示窗体

//这个区域不包括任务栏的

Rectangle ScreenArea = System.Windows.Forms.Screen.GetWorkingArea(this);

//这个区域包括任务栏,就是屏幕显示的物理范围

Rectangle ScreenArea = System.Windows.Forms.Screen.GetBounds(this);

int width1 = ScreenArea.Width; //屏幕宽度
int height1 = ScreenArea.Height; //屏幕高度
this.Location = new System.Drawing.Point(width1 - 窗体宽度, height1 - 窗体高度);  //指定窗体显示在右下角

//在母窗体的中间显示子窗体的位置计算

waitForm.Location = new Point((this.Location.X + (this.Width - waitForm.Width) / 2),
                                                (this.Location.Y + (this.Height - waitForm.Height) / 2));

posted on 2013-04-30 23:57 kenlistian 阅读(187) 评论(0)  编辑 收藏 引用 所属分类: csharp
只有注册用户登录后才能发表评论。