Delphi FMX Grid列头样式设定

 

procedure TForm1.StringGrid1ApplyStyleLookup(Sender: TObject);
var
  Header: THeader;
  HeaderItem: THeaderItem;
  I: Integer;
begin
  Header := THeader((Sender as TStringGrid).FindStyleResource('header'));
  if Assigned(Header) then
    begin
      for I := 0 to Header.Count - 1 do
        begin
          HeaderItem := Header.Items[I];
 
          HeaderItem.Font.Size := 100;
          HeaderItem.Font.Style := [TFontStyle.fsBold];
          HeaderItem.TextSettings.HorzAlign := TTextAlign.Center;
          // new code line:
          HeaderItem.StyledSettings := HeaderItem.StyledSettings - [TStyledSetting.Size, TStyledSetting.Style];
        end;
      Header.Height := 48;
    end;
end;

 

posted @ 2020-11-02 14:42  dqi1999  阅读(265)  评论(0编辑  收藏  举报