Screen获取桌面分辨率大小

//Screen获取桌面分辨率大小 
{
Screen.Width 宽
Screen.Height 高
这样可以根据显示器的分辨率信息设置窗体大小及位置
}

procedure TForm1.Button1Click(Sender: TObject);
begin
  Self.Memo1.Lines.Add('DeskTopResolution');
  Self.Memo1.Lines.Add('Width :'+Inttostr(Screen.Width));
  Self.Memo1.Lines.Add('Height :'+Inttostr(Screen.Height));
end;



//方法2
//Label1
//Label2

procedure TForm1.FormCreate(Sender: TObject);
var
  x:longint;
  a:string;
begin
  x := GetSystemMetrics(SM_CXSCREEN);

  Str(x,a);
  Label1.Caption := 'Height:' + a;
  x := GetSystemMetrics(SM_CYSCREEN);

  Str(x,a);
  Label2.Caption := 'Width:' + a;

end;




posted @ 2012-06-02 10:12  XE2011  阅读(171)  评论(0编辑  收藏  举报