11

質問は簡単です。Delphi で画面解像度の変更を検出する方法は?

4

1 に答える 1

20

メッセージを検出するだけで済み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;

サンプルのスクリーンショット

于 2013-02-08T12:29:59.980 に答える