最近做的项目发布后要做自适应,最大化后要铺满全屏(不覆盖任务栏),那么就需要获取工作区的大小,代码如下:
int width = System.Windows.Forms.SystemInformation.WorkingArea.Width;
int height= System.Windows.Forms.SystemInformation.WorkingArea.Height;
Debug.Log(width+","+height);
经测试:
- 任务栏正常显示的话,工作区宽高为:1920*1040
- 使用小任务栏按钮的话,工作区宽高为:1920*1050
使用到的dll:(我用的是基于.net4.x的dll,dll下载地址:https://download.csdn.net/download/weixin_39766005/11660884)
- System.Drawing.dll;
- System.Windows.Forms.dll;