Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TAdvStringGrid
How to have 2 different font colors for text within 1 cell

TAdvStringGrid supports the HTML as described at: https://www.tmssoftware.com/site/minihtml.asp As such, to have different font colors, background colors,... in 1 cell, you can write:

procedure TForm4.FormCreate(Sender: TObject);
begin
  AdvStringGrid1.Cells[1,1] := ''<P>Here is <FONT bgcolor="clBlue" color="clWhite">some</FONT> text</P>'';
  AdvStringGrid1.Cells[1,2]:= ''<P>Have <FONT color="clGreen">green</FONT> and <FONT color="clRed">red</FONT> text</P>'';
  AdvStringGrid1.Cells[1,3] := ''<P>This is a <FONT face="Arial" size="12" color="#FF0000">test</FONT></P>'';
end;