[求助]请问怎样得到显示器当前的分辨率和刷新率? 分辨率:宽(Screen.PrimaryScreen.Bounds.Width)× 高(Screen.PrimaryScreen.Bounds.Height) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 C#中改变显示器的分辨率http://www.truemesky.com/ReadNews.asp?NewsID=488&BigClassName=%B3%CC%D0%F2%C9%E8%BC%C6&SmallClassName=VC/C%A3%A3%D3%EF%D1%D4&SpecialID=0 获得屏幕刷新率using System;using System.Runtime.InteropServices;namespace ConsoleApplication{ public sealed class EntryPoint { private EntryPoint(){} [DllImport("Gdi32.dll", CharSet=CharSet.Auto, ExactSpelling=true)] public static extern int GetDeviceCaps(IntPtr hDC,int nIndex); /// <summary> /// 获得屏幕刷新率 /// </summary> public static int RefreshRate { get { IntPtr desktopDC = GetDC(GetDesktopWindow()); return GetDeviceCaps(desktopDC,116); } } [DllImport("User32.dll")] public extern static IntPtr GetDesktopWindow(); [DllImport("User32.dll")] public static extern IntPtr GetDC(IntPtr hWnd); static void Main() { Console.WriteLine("屏幕刷新率为: {0}Hz",RefreshRate); Console.ReadLine(); } }} 用managed DirectX可以直接调类库实现不过好像杀鸡用牛刀了 ~_~# !! Managed DirectX 还未普及 求帮助 win7 vS2010旗舰版 做的windows服务无法成功安装 在项目的引用中添加了System.data.Linq也没用,还是会报错CS0234 一个简单问题 输入字母或拼音,显示对应的汉字 c# winform中有没有播放器!!!! 菜鸟求助!!!C#问题!! 急问:Specified cast is not valid 什么毛病? 如何用C# 调用父类的父类中的方法 问一个关于datatable的decimal转string型的bug? 请问c#中类的析构问题?例如form 如何删除系统文件夹内的文件? 反白的字符串
C#中改变显示器的分辨率
http://www.truemesky.com/ReadNews.asp?NewsID=488&BigClassName=%B3%CC%D0%F2%C9%E8%BC%C6&SmallClassName=VC/C%A3%A3%D3%EF%D1%D4&SpecialID=0
using System;
using System.Runtime.InteropServices;
namespace ConsoleApplication
{ public sealed class EntryPoint
{
private EntryPoint(){} [DllImport("Gdi32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern int GetDeviceCaps(IntPtr hDC,int nIndex); /// <summary>
/// 获得屏幕刷新率
/// </summary>
public static int RefreshRate
{
get
{
IntPtr desktopDC = GetDC(GetDesktopWindow());
return GetDeviceCaps(desktopDC,116);
}
} [DllImport("User32.dll")]
public extern static IntPtr GetDesktopWindow(); [DllImport("User32.dll")]
public static extern IntPtr GetDC(IntPtr hWnd); static void Main()
{
Console.WriteLine("屏幕刷新率为: {0}Hz",RefreshRate);
Console.ReadLine();
}
}
}
不过好像杀鸡用牛刀了 ~_~# !!