Firemonkey ListBoxItem自绘
Posted 朝闻道
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Firemonkey ListBoxItem自绘相关的知识,希望对你有一定的参考价值。
ListBoxItem1的事件ListBoxItem1Paint
procedure TForm1.ListBoxItem1Paint(Sender: TObject; Canvas: TCanvas; const ARect: TRectF); begin if (Sender as TListBoxItem).IsSelected then begin Canvas.Fill.Kind := TBrushKind.Solid; Canvas.Fill.Color := TAlphaColorRec.Blue; Canvas.FillRect(ARect, 0, 0, [], 1); Canvas.Fill.Kind := TBrushKind.Solid; Canvas.Fill.Color := TAlphaColorRec.White; Canvas.FillText(ARect, (Sender as TListBoxItem).Text, False, 1, [], TTextAlign.Leading, TTextAlign.Center); end else begin Canvas.Fill.Kind := TBrushKind.Solid; Canvas.Fill.Color := TAlphaColorRec.White; Canvas.FillRect(ARect, 0, 0, [], 1); Canvas.Fill.Color := TAlphaColorRec.Black; Canvas.Fill.Kind := TBrushKind.Solid; Canvas.FillText(ARect, (Sender as TListBoxItem).Text, False, 1, [], TTextAlign.Leading, TTextAlign.Center); end; end;
http://www.cnblogs.com/cb168/p/5500756.html
以上是关于Firemonkey ListBoxItem自绘的主要内容,如果未能解决你的问题,请参考以下文章
WPF:改变ListBoxItem和ListViewItem的颜色