Wince 6.0获取设备的分辨率 自动设置窗体位置

调用微软提供给wince的API  “coredll.dll”

 

[DllImport("coredll.dll")]
public static extern int GetSystemMetrics(int nIndex);


//屏幕宽
int nWidth = GetSystemMetrics(0);
//屏幕高
int nHeight = GetSystemMetrics(1);
Point point = new Point((nWidth - this.Width) / 2, (nHeight this.Height) / 2);
this.Location = point;

 

用系统自带的API获取屏幕分辨实现窗体居中,不管是哪个WinCE系统的设备都可以使用的方法。

 

http://www.ybtiaoma.com

posted @ 2017-03-27 19:54  渴死的鱼0521  阅读(989)  评论(0编辑  收藏  举报