首页 > 其他 > 详细

Firemonkey ListBoxItem自绘

时间:2016-06-02 06:14:05      阅读:434      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!