其他分享
首页 > 其他分享> > Delphi 让Listview中的item可以显示不同的颜色

Delphi 让Listview中的item可以显示不同的颜色

作者:互联网

procedure TFormAlissaA.ListViewAAdvancedCustomDrawItem(Sender: TCustomListView; Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage; var DefaultDraw: Boolean);
begin
  if Item.SubItems[0] = 'Send' then
  begin
    Sender.Canvas.Font.Color := clWindowText;
    Sender.Canvas.Font.Name := '宋体';
    Sender.Canvas.Font.Size := 12;
    Sender.Canvas.Brush.Color := $d0d0f2;
  end
  else if Item.SubItems[0] = 'Recv' then
  begin
    Sender.Canvas.Font.Color := clWindowText;
    Sender.Canvas.Font.Name := '宋体';
    Sender.Canvas.Font.Size := 12;
    Sender.Canvas.Brush.Color := $e6c8c8;
  end
end;

标签:Canvas,Font,Sender,Item,Color,Delphi,begin,item,Listview
来源: https://www.cnblogs.com/YXGust/p/16593145.html