??笆篈э跑棵辊秆猂??
и稱?祘Αい糶?捌祘Α, ??钡?把计, 匡拒盢棵辊秆猂?э? 640X480 ┪ 800X600 单单?
眤惠璶把σ EnumDisplaySettings() 籔 ChangeDisplaySettings 硂ㄢ? WinAPI. ??Τ?玥?糶??ㄒ?, 叫眤刚刚?.
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;
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------