[Lazarus] TListview with colored text

Alexsander Rosa alexsander.rosa at gmail.com
Thu Nov 4 18:03:02 CET 2010


For now I'm just doing
*Retang.Right := Retang.Right -4;*
Is there a better way?

2010/11/1 Alexsander Rosa <alexsander.rosa at gmail.com>

> 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/20101104/2498335c/attachment-0003.html>


More information about the Lazarus mailing list