0

我在 Delphi 中编程,我希望有一个始终可见的垂直滚动条,即使行数为 1(DefaultDrawing 选项未激活,我正在使用 Canvas 绘制单元格)。

谁能帮我 ?

4

1 回答 1

0

您可以插入TStringGrid并覆盖该Resize方法,如下所示:

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.

设置锚点的小测试在这里给出了很好的结果。

于 2016-05-10T21:13:10.780 回答