标签:
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
标签:
原文地址:http://www.cnblogs.com/findumars/p/5551679.html