我正在使用 Lazarus v0.9.30(32 位编译器)。我有以下代码用于显示存储在与 TStringGrid 中的 TColumnTitle 对象关联的对象中的提示文本。
procedure TTmMainForm.TmApplicationPropertiesShowHint
(
var HintStr: string;
var CanShow: boolean;
var HintInfo: THintInfo
);
var
aGrid : TStringGrid;
aColumnTitle : TTmColumnTitle;
aRow : integer;
aColumn : integer;
begin
aRow := 0;
aColumn := 0;
HintInfo.HintMaxWidth := 200;
HintInfo.HideTimeout := 10000;
HintInfo.HintColor := $00D7FBFA;
//Get a pointer to the current grid.
aGrid := TStringGrid(HintInfo.HintControl);
//Find out what cell the mouse is pointing at.
aGrid.MouseToCell(HintInfo.CursorPos.X, HintInfo.CursorPos.Y, aColumn, aRow);
if ((aRow = 0) and (aColumn < aGrid.ColCount)) then
begin
//Get the object associated with the column title.
aColumnTitle := TTmColumnTitle(aGrid.Objects[aColumn, aRow]);
//Define where the hint window will be displayed.
HintInfo.CursorRect := aGrid.CellRect(aColumn, aRow);
//Display the hint.
HintStr := Trim(aColumnTitle.stHint);
end; {if}
end;
我可以访问 HintInfo 对象并希望使用它来更改提示文本的字体大小。HintInfo 对象提供对 HintInfo.HintControl.Font 的访问,但使用它会更改底层 TStringGrid 中所有单元格文本的字体。HintInfo 对象还提供对 Hintinfo.HintWindowClass.Font 的访问,但您无法访问 Font.Size。有没有办法修改提示的字体大小?