Mirror

Make the scrollbar of a TStringGrid show a proportional thumb (Views: 717)


Problem/Question/Abstract:

How to make the scrollbar of a TStringGrid show a proportional thumb

Answer:

procedure TForm1.Button1Click(Sender: TObject);
var
  info: TScrollInfo;
begin
  fillchar(info, sizeof(info), 0);
  with info do
  begin
    cbsize := sizeof(info);
    fmask := SIF_ALL;
    GetScrollInfo(stringgrid1.handle, SB_VERT, info);
    fmask := fmask or SIF_PAGE;
    nPage := 5 * (nmax - nmin) div stringgrid1.rowcount;
    {whatever number of cells you consider a "page"}
  end;
  setscrollinfo(stringgrid1.handle, SB_VERT, info, True);
end;

<< Back to main page