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;




原文地址:https://www.cnblogs.com/xe2011/p/2531624.html