[Lazarus] TListview with colored text

Alexsander Rosa alexsander.rosa at gmail.com
Mon Nov 1 14:46:23 CET 2010


I've managed to set the color of a specific subitem, but it's getting
misaligned horizontally.
It seems there's some small margin around the text and I do not know how to
calculate it.

if (SubItem = 4) and (StrToIntDef(Item.SubItems[4],0) > 5) then
  begin
    Retang := Item.DisplayRectSubItem(SubItem+1, drBounds);
    estilo := TCustomListView(Sender).Canvas.TextStyle;
    estilo.Layout := tlCenter;
    estilo.SystemFont := false;
    estilo.Alignment := taRightJustify;
    TCustomListView(Sender).Canvas.Font.Color := clRed;

TCustomListView(Sender).Canvas.TextRect(Retang,Retang.Left,0,Item.SubItems[4],estilo);
    DefaultDraw := false;
  end;

Any ideas?

-- 
Atenciosamente,
Alexsander da Rosa
Linux User #113925

"Extremismo na defesa da liberdade não é defeito.
Moderação na busca por justiça não é virtude."
-- Barry Goldwater
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20101101/a868fda5/attachment-0002.html>


More information about the Lazarus mailing list