C#获取当前屏幕大小或任务栏的大小,不用API.
来源:互联网 发布:淘宝网免费代理商 编辑:程序博客网 时间:2024/05/23 01:14
使用SystemInformation类就行了.
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
string currentScreenSize_OutTaskBar=SystemInformation.WorkingArea.Width.ToString() + "," +SystemInformation.WorkingArea.Height.ToString();
MessageBox.Show("当前的屏幕除任务栏外的工作域大小为:"+currentScreenSize_OutTaskBar);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
string currentScreenSize=System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width.ToString() + "," + System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height.ToString();
MessageBox.Show("当前的屏幕包括任务栏的工作域大小为:"+currentScreenSize);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Size OutTaskBarSize = new Size(SystemInformation.WorkingArea.Width, SystemInformation.WorkingArea.Height);
Size ScreenSize = new Size(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width, System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height);
Size TaskBarSize;
TaskBarSize = new Size(
(ScreenSize.Width - (ScreenSize.Width - OutTaskBarSize.Width)),
(ScreenSize.Height - OutTaskBarSize.Height)
);
MessageBox.Show("任务栏大小:" + TaskBarSize.Width + "," + TaskBarSize.Height);
using System.Windows.Forms;
获取屏幕分辨率
int SH = Screen.PrimaryScreen.Bounds.Height;
int SW = Screen.PrimaryScreen.Bounds.Width;
获取窗口居中Top和Left
int thisH=100;
int thisW=200;
int SH = (Screen.PrimaryScreen.Bounds.Height - 30 - thisH) / 2;
int SW = (Screen.PrimaryScreen.Bounds.Width - 10 - thisW) / 2;
- C#获取当前屏幕大小或任务栏的大小,不用API.
- C#获取当前屏幕大小或任务栏的大小,不用API
- C#获取当前屏幕大小或任务栏的大小
- C#获取屏幕大小或任务栏大小
- C#获取屏幕大小或任务栏大小
- 获取屏幕大小 或任务栏大小 或 工作域大小
- c#获取当前屏幕大小
- 获取屏幕大小的API
- C# 获取屏幕的大小
- C# 获取屏幕的大小
- C#获取屏幕大小的“简单整理”。。
- 获取屏幕的大小
- 获取屏幕的大小
- 获取屏幕的大小
- 如何获取当前设备的屏幕的大小初始化UIWindow
- Robotium测试之——获取当前屏幕的大小
- Robotium测试之——获取当前屏幕的大小
- Robotium测试之——获取当前屏幕的大小
- VS快捷键,常用加粗
- INNO Setup 使用笔记
- 控件的BeginInvoke 和 Invoke
- Android Google Map实例 - 获取cdma基站经纬度(Android mapview)
- 强大的代码生成工具MyGeneration
- C#获取当前屏幕大小或任务栏的大小,不用API.
- mysq高效查询语句
- iPhone How-to:给UIView拍照
- Android Launcher2分析之(一)----Res分析
- 使用GhostDoc为代码生成注释文档
- iPhone How-to:播放gif动画
- Sandcastle初探——官方版的NDoc
- iPhone How-to:给导航栏贴图
- Using Fixpoint to Solve Mathmatic Equation ( 无限float运算的扩展 stream style)