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窗口随机类名

Delphi 删除字符串重复的符号只保留一个

Delphi加载图像存储到数据库中

Delphi 下找到目录中的所有文件夹

Delphi2010新功能:tdirectory.getfiles 支持通配符

Delphi memo1自动循环上下滚屏

idtcpclient和idtcpclient 主要属性和方法

Delphi 计算农历的单元

Delphi tnethttpclient https忽略证书验证

winapi 字符及字符串函数(15): charnext、charprev

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



打赏

取消

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

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

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

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

评论

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

    暂无评论...