调用微软提供给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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-07
  • 2021-12-06
  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-01
  • 2021-05-03
  • 2022-12-23
  • 2022-12-23
  • 2022-01-18
  • 2022-12-23
相关资源
相似解决方案