Delphi 获取屏幕分辨率与Windows任务栏的高度
屏幕分辨率:
宽: screen.WorkAreaWidth;
高: screen.WorkAreaHeight;
第一种:需要引用Windows单元
- ShowMessage(IntToStr(GetSystemMetrics(SM_CYSCREEN)-GetSystemMetrics(SM_CYFULLSCREEN)-GetSystemMetrics(SM_CYCAPTION)));
第二种:需要引用Windows单元
- function GetSystemTaskBarHeight:Integer;
- var
- R:TRect;
- begin
- SystemParametersInfo(SPI_GETWORKAREA,0,@R,0);
- Result:=Screen.Height-R.Bottom;
- end;
第三种:要引用ShellAPI单元
- function GetTaskBarRect: Integer;
- var
- TBData: TAPPBARDATA;
- begin
- TBData.cbSize := SizeOf(TAPPBARDATA);
- SHAppBarMessage(ABM_GETTASKBARPOS, TBData);
- Result :=Screen.Height-TBData.rc.Top;
- end;