问题很简单。如何在Delphi中检测屏幕分辨率的变化?
问题很简单。如何在Delphi中检测屏幕分辨率的变化?
你只需要检测 WM_DISPLAYCHANGE
消息。
例如,
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;