Jump to content

Recommended Posts

Posted

I am display statistics in a string grid, such that odd numbered rows contain values, and even rows contain labels, and that part works fine... and I have larger font in the "value" rows. But...

 

1. Is it possible to also display images in cells in a unistringgrid?

 

2. I would also like to center the text in the cells? (I know that it is possible in unidbgrid, but cannot see how to do it with a stringgrid component.

 

Thanks in advance.

 

Tim

  • Administrators
Posted

Cells can accept HTML content, so:

procedure TMainForm.UniStringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  var Value: string; Attribs: TUniCellAttribs);
begin
  if (ACol = 1) and (ARow = 1) then
    Value := uniImage2Url(UniImage1.Picture.Graphic, 0, 0);
end;

or

procedure TMainForm.UniStringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  var Value: string; Attribs: TUniCellAttribs);
begin
  if (ACol = 1) and (ARow = 1) then
    Value := '<img src="/files/Database.png">';

end;

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...