我正在跑Lazarus 0.9.30.
我TStringGrid在表单上有一个标准,并希望在将鼠标指针移动到列标题上时显示不同的提示.我正在使用此代码执行此操作并且它有点工作但是您经常需要单击单元格以获取提示更改,当我实际希望它在鼠标指针移动时更改.我将所有提示存储在我使用列索引作为键搜索的集合中.有没有办法更顺畅地显示提示?
procedure TTmMainForm.SgScoutLinkMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var
R, C: Integer;
begin
R := 0;
C := 0;
SgScoutLink.MouseToCell(X, Y, C, R);
with SgScoutLink do
begin
if (R = 0) then
if ((C >= 3) and (C <= 20)) then
begin
SgScoutLink.Hint := FManager.ScoutLinkColumnTitles.stGetColumnTitleHint(C-3);
SgScoutLink.ShowHint:= True;
end; {if}
end; {with}
end;
Run Code Online (Sandbox Code Playgroud) 我在表单上有一个标准的TStringGrid.我在网格中有一个包含许多列的固定行,这些列都是TGridColumns对象.我使用对象检查器设置了列标题,默认方向是水平的.有什么方法可以使方向垂直(就像在Excel中的单元格中一样)?
我正在使用拉撒路 0.9.30.2。我有一个标准的 TForm,上面有一个标准的 TStringGrid。在设计时,字符串网格上没有列或行。在对象检查器中设置以下值。
ColCount = 0
Columns = 0
FixedCols = 0
FixedRows = 0
RowCount = 0
Run Code Online (Sandbox Code Playgroud)
我想在运行时添加许多 TGridColumns,并且已经能够这样做,但总是得到一个固定列,这是我不想要的。我已经编写了与下面的示例非常相似的代码来执行此操作。当我编译并运行它时,我得到以下结果。
如何在运行时去掉固定列并保留剩余的列?
unit test;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Grids;
type
TForm1 = class(TForm)
SgGrid: TStringGrid;
procedure FormCreate(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
procedure TForm1.FormCreate(Sender: TObject);
var
GridColumn : TGridColumn;
anIndex : integer;
begin
for anIndex := 0 to 5 do
begin
GridColumn := SgGrid.Columns.Add;
GridColumn.Width := 50;
GridColumn.Title.Caption := 'Col …Run Code Online (Sandbox Code Playgroud)