相关疑难解决方法(0)

在vsReport模式下ListView项目和行的着色

我希望将一行换成灰色,另一行换成白色.
我有以下代码,但在Windows 7中
有垂直行列的空白区域.如何为所有行着色?

procedure TForm2.Update_ListBoxCustomDrawItem(Sender: TCustomListView;
  Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
 if Item.Index mod 2=0
 then
  begin
   Sender.Canvas.Font.Color:=clBlack;
   Sender.Canvas.Brush.Color:=$F6F6F6;
  end
 else
  begin
   Sender.Canvas.Font.Color:=clBlack;
   Sender.Canvas.Brush.Color:=clWhite;
  end;
end;
Run Code Online (Sandbox Code Playgroud)

delphi listview row brush colors

1
推荐指数
1
解决办法
1万
查看次数

Delphi:列表视图中的Canvas.FillRect

在更改列表视图的SubItem文本时,我需要刷整并填充整行:

procedure TForm1.ListViewDrawItem(Sender: TCustomListView;
  Item: TListItem; Rect: TRect; State: TOwnerDrawState);
begin
  if Item.SubItems[2]='Done'
   then
  begin
    Sender.Canvas.Font.Color := clBlack;
    Sender.Canvas.Brush.Color := clGreen;
    Sender.Canvas.Brush.Style := bsSolid;
    Sender.Canvas.FillRect(Rect);
  end;
end;
Run Code Online (Sandbox Code Playgroud)

但是Sender.Canvas.FillRect(Rect)将仅填充SubItem的Rect.如何填满整行?

这个问题是在Delphi的基础上提出的:如何在CustomDrawItem的List View中绘制小图标

谢谢!

delphi listview brush rect fill

0
推荐指数
1
解决办法
6107
查看次数

标签 统计

brush ×2

delphi ×2

listview ×2

colors ×1

fill ×1

rect ×1

row ×1