function SetColorDepth_xy(Depth,w,h:integer):boolean;<br>var<br> lpDevMode:TDeviceMode;<br>begin<br> Result:=EnumDisplaySettings(nil, 0, lpDevMode);<br> if Result then<br> begin<br> lpDevMode.dmFields := dm_PelsWidth or dm_PelsHeight or dm_BitsPerPel;<br> lpDevMode.dmBitsPerPel:=depth;<br> lpDevMode.dmPelsWidth:=w;<br> lpDevMode.dmPelsHeight:=h;<br> Result := ChangeDisplaySettings(lpDevMode, 0)=DISP_CHANGE_SUCCESSFUL;<br> end;<br>end;<br><br><br>procedure TForm1.Button1Click(Sender: TObject);<br>begin<br>SetColorDepth_xy(16,800,600);<br>end;<br>