2011-07-04 150 views
0

我有一个ListView(vsReport):最后一个SubItem有一个文本“等待”。然后我会将其更改为“ok”或“error”。如何在绿色(ok)和红色(错误)中绘制整行(如果在CustomDrawItem中使用Sender.Canvas.Brush.Color,它将成为Windows 7中列之间的间隙)?德尔福:绘制行ListView

谢谢!

回答

1

你可以针对它做

procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView; 
    Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean); 
begin 
    if Item.Index = Sender.Items.Count - 1 then 
    begin 
    Sender.Canvas.Brush.Color := clSkyBlue; 
    Sender.Canvas.FillRect(Item.DisplayRect(drBounds)); 
    end; 
end; 

,但我的意见,因为它是越野车(我不知道如何解决它)。

Screenshot http://privat.rejbrand.se/listviewentirerowfill.png

+0

到底是什么这个方法越野车,好吗? –

+0

尝试移动鼠标,你会看到:) – maxfax

+0

我有很多应用程序,他们都通常没有空白的油漆。我从来没有一个程序在ListView中有空白。 – maxfax