我们可以设定一个字段的值,用以判断用什么颜色显示listview的颜色,例子如下 procedure TMainForm.ListView2CustomDrawItem(Sender: TCustomListView; Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);begin if item.SubItems.Strings[7] = Edit11.Text then begin item.
//增加 i := ListView1.Items.Count; with ListView1 do begin ListItem:=Items.Add; ListItem.Caption:= IntToStr(i); ListItem.SubItems.Add('第 '+IntToStr(i)+' 行'); ListItem.SubItems.Add('第三列内容'); end; //按标题删除 Do if ListView1.Items[i].Caption = Edit1.Text the
1.根据条件更改某一单元格的颜色 procedure TMainFrm.First_DGDrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState); begin if DM.FirstListStatus.AsString='生产' then begin First_DG.Canvas.Font.Color:=clGreen end els