>Ok, I give up, after several days of digging I have to ask. How
do I
>find out if a control, such as a TMemo, or TDbGrid, has a scrollbar
>showing, and more importantly, the Width of the scrollbar.
{TscrollInfo is defined in windows.pas as follows)
TScrollInfo = packed record
cbSize: UINT;
fMask: UINT;
nMin: Integer;
nMax: Integer;
nPage: UINT;
nPos: Integer;
nTrackPos: Integer;
end;
}
{a form with a memo and a button on it}
procedure TForm1.Button1Click(Sender: TObject);
var T:TScrollInfo;
ScrollbarWidth:integer;
begin
T.cbSize:=sizeof(T); //important!!!
if GetScrollInfo(memo1.Handle,SB_VERT,T) then
with memo1.lines do
begin
add('cbSize :'+inttostr(T.cbSize));
add('fMask :'+inttostr(T.fMask));
add('nMin :'+inttostr(T.nMin));
add('nMax :'+inttostr(T.nMax));
add('nPage :'+inttostr(T.nPage));
add('nPos :'+inttostr(T.nPos));
add('nTrackPos :'+inttostr(T.nTrackPos));
{the width of the trackbar can be retrived this way}
ScrollbarWidth:=GetSystemMetrics(SM_CXVSCROLL);
//or SM_CYHSCROLL
memo1.lines.add(inttostr(ScrollBarWidth));
end else memo1.lines.add('No vertical scrollbar'); //...and
so on
end;