为了创建字体选择器,我需要获取Firemonkey可用的字体列表.由于FireMonkey中不存在Screen.Fonts我以为我需要使用FMX.Platform?例如:
if TPlatformServices.Current.SupportsPlatformService(IFMXSystemFontService, IInterface(FontSvc)) then
begin
edit1.Text:= FontSvc.GetDefaultFontFamilyName;
end
else
edit1.Text:= DefaultFontFamily;
Run Code Online (Sandbox Code Playgroud)
但是,唯一可用的功能是返回默认的字体名称.
目前我并不担心跨平台支持,但如果我要转向Firemonkey,我宁愿不依赖Windows调用.
我已经看到这个问题是另一个问题的一部分,所以知道它不能只是我......如果我打开一个新的FireMonkey2 HD应用程序,添加一个TButton和TStringGrid,然后将其添加到click事件的按钮上当我点击按钮时,网格中没有发生!
procedure TForm33.Button1Click(Sender: TObject);
var
i: Integer;
begin
for i:= 0 to 6 do
begin
StringGrid1.Cells[0,i] := 'Row:' + IntToStr(i);
end;
stringgrid1.UpdateColumns;
stringgrid1.SetFocus;
end;
Run Code Online (Sandbox Code Playgroud)
有任何想法吗 ?PS我也尝试过使用TStringGrid.OnGetValue,它仍然不会在StringGrid中显示任何内容.
进一步研究TStringGrid源代码后,C为零,因此Cell永远不会被设置.
procedure TStringGrid.SetValue(Col, Row: Integer; const Value: TValue);
var
C: TColumn;
begin
C := Columns[Col];
if Assigned(C) then
begin
C.UpdateRowCount(RowCount);
C.SetCells(Row, Value);
end;
Run Code Online (Sandbox Code Playgroud)
我似乎在"处女"StringGrid中没有列,所以你如何添加它们?有一个r + w RowCount属性,但ColCount只读...