⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 enumdisplaysettingsu.pas

📁 Delphi Win32核心API参考光盘源码 本书包含了常用的Windows API函数
💻 PAS
字号:
unit EnumDisplaySettingsU;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    ListBox1: TListBox;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  DeviceInfo: TDevMode;         // holds device information
  DeviceCount: Integer;         // tracks the number of display modes
begin
  {initialize the tracking variable}
  DeviceCount := 0;

  {enumerate all display modes for the current display device}
  while EnumDisplaySettings(NIL, DeviceCount, DeviceInfo) do
  begin
    {display the relevent information for the display mode}
    ListBox1.Items.Add('Device '+IntToStr(DeviceCount)+' -');
    ListBox1.Items.Add('Pixels/Inch: '+IntToSTr(DeviceInfo.dmLogPixels));
    ListBox1.Items.Add('Bits/Pixel: '+IntToStr(DeviceInfo.dmBitsPerPel));
    ListBox1.Items.Add('Pixel Width: '+IntToStr(DeviceInfo.dmPelsWidth));
    ListBox1.Items.Add('Pixel Height: '+IntToStr(DeviceInfo.dmPelsHeight));

    {indicate the display mode type}
    case DeviceInfo.dmDisplayFlags of
      DM_GRAYSCALE:  ListBox1.Items.Add('Display Mode: Grayscale');
      DM_INTERLACED: ListBox1.Items.Add('Display Mode: Interlaced');
    end;

    {indicate the refresh rate}
    if (DeviceInfo.dmDisplayFrequency=0)or(DeviceInfo.dmDisplayFrequency=1) then
      ListBox1.Items.Add('Refresh Rate: Hardware Default')
    else
      ListBox1.Items.Add('Refresh Rate: '+IntToStr(DeviceInfo.dmDisplayFrequency)+' hrz');

    {add a blank line and increment the tracking variable}
    ListBox1.Items.Add('');
    Inc(DeviceCount);
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -