WEB开发网
开发学院软件开发Delphi 控制Windows分辨率 阅读

控制Windows分辨率

 2006-02-04 13:29:32 来源:WEB开发网   
核心提示:EnumDisplaySettings() 和ChangeDisplaySettings(),function DynamicResolution(X, Y: Word): BOOL;var lpDevMode: TDeviceMode;begin Result := EnumDisplaySettings(nil,
EnumDisplaySettings() 和ChangeDisplaySettings(),



function DynamicResolution(X, Y: Word): BOOL;
var
  lpDevMode: TDeviceMode;
begin
  Result := EnumDisplaySettings(nil, 0, lpDevMode);
if Result then
begin
lpDevMode.dmFields := DM_PELSWIDTH Or DM_PELSHEIGHT;
lpDevMode.dmPelsWidth := X;
lpDevMode.dmPelsHeight := Y;
Result := ChangeDisplaySettings(lpDevMode, 0) = DISP_CHANGE_SUCCESSFUL;
end
end;

PRocedure TForm1.Button1Click(Sender: TObject);
begin
if DynamicResolution(640, 480) then
ShowMessage('Now is 640*480');
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  if DynamicResolution(800, 600) then
    ShowMessage('Now is 800*600');
end;

Tags:控制 Windows 分辨率

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接