How to detect screen resolution change in Delphi?

我的未来我决定 提交于 2019-12-09 15:27:37

问题


The question is simple. How to detect screen resolution change in Delphi ?


回答1:


You only need to detect the WM_DISPLAYCHANGE message.

For instance,

TForm1 = class(TForm)
private
protected
  procedure WMDisplayChange(var Message: TWMDisplayChange);
    message WM_DISPLAYCHANGE;
  { Private declarations }

public
  { Public declarations }
end;

...

procedure TForm1.WMDisplayChange(var Message: TWMDisplayChange);
begin
  ShowMessageFmt('The screen resolution has changed to %d×%d×%d.',
    [Message.Width, Message.Height, Message.BitsPerPixel]);
end;



来源:https://stackoverflow.com/questions/14772588/how-to-detect-screen-resolution-change-in-delphi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!