I'm programming in Delphi and I want to have a vertical Scrollbar that is always visible, even if the number of rows is 1 (the DefaultDrawing option is not active, i'm using Canvas to draw the cells).
Can anyone help me ?
I'm programming in Delphi and I want to have a vertical Scrollbar that is always visible, even if the number of rows is 1 (the DefaultDrawing option is not active, i'm using Canvas to draw the cells).
Can anyone help me ?
You could interpose TStringGrid
and override the Resize
method, like so:
unit Unit1;
interface
uses
Winapi.Windows, System.Classes, Vcl.Controls, Vcl.Forms, Vcl.Grids;
type
TStringGrid = class(Vcl.Grids.TStringGrid)
protected
procedure Resize; override;
end;
TForm1 = class(TForm)
StringGrid1: TStringGrid;
end;
implementation
{$R *.dfm}
{ TStringGrid }
procedure TStringGrid.Resize;
begin
inherited Resize;
ShowScrollBar(Handle, SB_VERT, True);
end;
end.
A minor test with anchors set gives good results here.