Mega Code Archive

 
Categories / Delphi / VCL
 

How to get the extends of a visible scrollbar

Title: How to get the extends of a visible scrollbar function GetScrollbarWidth(ctl: TControl): Integer; begin if ctl is TWinControl then begin if (GetWindowlong(TWinControl(Ctl).Handle, GWL_STYLE) and WS_VSCROLL) 0 then Result := GetSystemMetrics(SM_CXVSCROLL) else Result := 0; end else begin Result := 0; end; end; function GetScrollbarHeight(ctl: TControl): Integer; begin if ctl is TWinControl then begin if (GetWindowlong(TWinControl(Ctl).Handle, GWL_STYLE) and WS_HSCROLL) 0 then Result := GetSystemMetrics(SM_CXHSCROLL) else Result := 0; end else begin Result := 0; end; end;