Jump to content

How to change the font in a unidbgrid and/or an unimdbgrid in runtime?


asapltda

Recommended Posts

5 hours ago, asapltda said:

but the idea is to change the entire font of the dbgrid, not only for one column or row

Yes I know.

10 hours ago, Sherzod said:

One possible solution, you can use OnDrawColumnCell event for this.

  public
    { Public declarations }
    AGridFontSize: Integer;
  end;
procedure TMainForm.UniDBGrid1DrawColumnCell(Sender: TObject; ACol,
  ARow: Integer; Column: TUniDBGridColumn; Attribs: TUniCellAttribs);
begin
  Attribs.Font.Size := AGridFontSize;
end;
procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  AGridFontSize := 12;
  UniDBGrid1.Refresh;
end;

 

Link to comment
Share on other sites

  • 2 years later...
5 hours ago, FFREDIANELLI said:

Hi, how to change the font family name to  "Century Gothic" ? in the dbgrid, how to use the tunifontname ? in this example ?

Hello,

Well, about the same, using a variable as you wish:

On 7/10/2021 at 8:28 AM, Sherzod said:
procedure TMainForm.UniDBGrid1DrawColumnCell(Sender: TObject; ACol,
  ARow: Integer; Column: TUniDBGridColumn; Attribs: TUniCellAttribs);
begin
  Attribs.Font.Size := AGridFontSize;
end;
procedure TMainForm.UniDBGrid1DrawColumnCell(Sender: TObject; ACol,
  ARow: Integer; Column: TUniDBGridColumn; Attribs: TUniCellAttribs);
begin
  Attribs.Font.Name := 'Century Gothic';
end;

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...