unit Kontrast2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private-Deklarationen }
public
Procedure ShowMe_resolution;
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
// Zeigt die Werte in Label an ..
Procedure TForm1.ShowMe_resolution;
var
lpDevMode: TDeviceMode;
begin
lpDevMode.dmFields := DM_PELSWIDTH Or DM_PELSHEIGHT;
label1.caption := inttostr(lpDevMode.dmPelsWidth);
label2.caption := IntToStr(lpDevMode.dmPelsHeight);
end;
// Auflösung ändern
function change_resolution(width, height: word): boolean;
var
lpDevMode: TDeviceMode;
begin
Result := EnumDisplaySettings(nil, 0, lpDevMode);
if Result then begin
lpDevMode.dmFields := DM_PELSWIDTH Or DM_PELSHEIGHT;
lpDevMode.dmPelsWidth := width;
lpDevMode.dmPelsHeight := height;
Result := ChangeDisplaySettings(lpDevMode, CDS_UPDATEREGISTRY) = DISP_CHANGE_SUCCESSFUL;
end;
end;
// Button Klick zeigt Resolution an
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMe_Resolution;
end;
// Button Klick wechselt in 800x600
procedure TForm1.Button2Click(Sender: TObject);
begin
change_resolution(800,600);
end;
// Button Klick wechselt in 1280x1024
procedure TForm1.Button3Click(Sender: TObject);
begin
change_resolution(1280,1024)
end;
end.