码迷,mamicode.com
首页 > 其他好文 > 详细

Firemonkey ListBoxItem自绘

时间:2016-06-02 06:15:27      阅读:229      评论:0      收藏:0      [点我收藏+]

标签:

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自绘

标签:

原文地址:http://www.cnblogs.com/findumars/p/5551679.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!