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

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

时间:2022-08-16 22:02:31浏览次数:53  
标签:Canvas Font Sender Item Color Delphi begin item Listview

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
From: https://www.cnblogs.com/YXGust/p/16593145.html

相关文章