Как получить ширину ScrollBar
// These snippets get the width of the scrollbars, as defined BY THE USER
// on the Display Properties screen Appearance tab. The code below is
// for a string grid, but any component that has scrollbars should work as
// well.
//
// by Robert E. Baker (robertbaker@bigfoot.com)
//
// For a vertical scrollbar
if ScrollBarVisible(StringGrid1.Handle, WS_VSCROLL) then
ScrollBarWidth := GetSystemMetrics(SM_CXVSCROLL)
else
ScrollBarWidth := 0;
// For a vertical scrollbar
if ScrollBarVisible(StringGrid1.Handle, WS_HSCROLL) then
ScrollBarWidth := GetSystemMetrics(SM_CXHSCROLL)
else
ScrollBarWidth := 0;
// The code for the ScrollBarVisible function is below:
function ScrollBarVisible(Handle : HWnd; Style : Longint) : Boolean;
begin
Result := (GetWindowLong(Handle, GWL_STYLE) and Style) <> 0;
end;
|
|