要得到显示器的分辨率,由下列程序得到:<br>var<br>x:longint;<br>a:string;<br>begin<br>x := GetSystemMetrics(SM_CXSCREEN);<br>Str(x,a);<br>Label1.Caption := '显示器水平分辨率' + a;<br>x := GetSystemMetrics(SM_CYSCREEN);<br>Str(x,a);<br>Label2.Caption := '显示器垂直分辨率' + a;<br>end;<br><br><br> 改变分辨率<br><br>function Resolution(X,Y:word):boolean;<br>var<br> DevMode:TDeviceMode;<br> begin<br> Result:=EnumDisplaySettings(nil,0,DevMode);<br> if Result then<br> begin<br> DevMode.dmFields:=DM_PELSWIDTH Or DM_PELSHEIGHT;<br> DevMode.dmPelsWidth:=X;<br> DevMode.dmPelsHeight:=Y;<br> Result:=ChangeDisplaySettings(DevMode,0)=DISP_CHANGE_SUCCESSFUL;<br> end;<br> end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br> if Resolution(800,600) then ShowMessage('800×600模式!');<br>end;<br><br>procedure TForm1.Button2Click(Sender: TObject);<br>begin<br> if Resolution(1280,1024) then ShowMessage('1280X1024模式!');<br>end;<br><br>procedure TForm1.Button3Click(Sender: TObject);<br>begin<br> if Resolution(1024,768) then ShowMessage('1024X768模式!');<br>end;