Delphi 取得当前监视器的分辨率


本文整理自网络,侵删。

 var

  MonInfo: TMonitorInfo;

begin

  MonInfo.cbSize := SizeOf(MonInfo);

  GetMonitorInfo(MonitorFromWindow(Handle, MONITOR_DEFAULTTONEAREST), @MonInfo);

  ShowMessage(Format('Current resolution: %dx%d',

              [MonInfo.rcMonitor.Right - MonInfo.rcMonitor.Left,

               MonInfo.rcMonitor.Bottom - MonInfo.rcMonitor.Top]));

end;

 

动态设置屏幕分辨率

Xe10.2测试可用。

 

 

 

function SetScreen(x, y: Word): Boolean;

 

var

 

   DevMode: TDeviceMode;

 

begin

 

   Result := EnumDisplaySettings(nil, 0, DevMode);

 

   if Result then

 

   begin

 

    DevMode.dmFields := DM_PELSWIDTH or DM_PELSHEIGHT;

 

    DevMode.dmPelsWidth := x;

 

    DevMode.dmPelsHeight := y;

 

    Result := ChangeDisplaySettings(DevMode, 0) = DISP_CHANGE_SUCCESSFUL;

 

   end;

 

end;


相关阅读 >>

Delphi 的字符串在 firemonkey 模式下

Delphi隐藏指定程序的托盘图标

Delphi 从摄像头获取照片并转换为特定的格式

Delphi dcc32.exe 参数说明

Delphi xe-xe3下最简单的获取硬盘序列号

Delphi 将字符串转换为c-escape转义字符串格式

Delphi 中文字符串函数问题rightstr

Delphi 如何将颜色值转换为html格式?

Delphi 2009 泛型容器单元(generics.collections)[3]: tstack<t>

Delphi xe5 中tmemo控件的应用――for android

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...