Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2010-11

TListview with colored text

2 messages · 1 person · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Alexsander Rosa

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.freepascal.org/pipermail/lazarus/attachments/20101101/a868fda5/attachment.html>

Reply by email

Alexsander Rosa
to Alexsander Rosa

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

2010/11/1 Alexsander Rosa

Show quoted text 21 lines
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.freepascal.org/pipermail/lazarus/attachments/20101104/2498335c/attachment.html>

Reply by email