向窗體上添加兩個Button控件
在程序中添加一個自定義函數DynamicResolution
function TfrmMain
var
lpDevMode: TDeviceMode;
begin
Result := EnumDisplaySettings(nil
if Result then
begin
lpDevMode
lpDevMode
lpDevMode
Result:=ChangeDisplaySettings(lpDevMode
end;
end;
在程序運行過程中
程序首先通過EnumDisplaySettings來取得當前屏幕的分辨率
程序代碼如下
unit Unit
interface
uses
Windows
Dialogs
type
TfrmMain = class(TForm)
btn
btn
procedure btn
procedure btn
private
{ Private declarations }
public
{ Public declarations }
function DynamicResolution(X
end;
var
frmMain: TfrmMain;
implementation
{$R *
function TfrmMain
var
lpDevMode: TDeviceMode;
begin
Result := EnumDisplaySettings(nil
if Result then
begin
lpDevMode
lpDevMode
lpDevMode
Result:=ChangeDisplaySettings(lpDevMode
end;
end;
procedure TfrmMain
begin
if DynamicResolution(
begin
ShowMessage(
end;
end;
procedure TfrmMain
begin
if DynamicResolution(
begin
ShowMessage(
end;
end;
end
保存文件
在程序運行過程中
From:http://tw.wingwit.com/Article/program/Delphi/201311/24653.html