listview控件的使用问题!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
我想为listview控件在添加每个item时,设置不同的背景颜色,但不能生效????!
代码如下 :
procedure TForm1.LV1DrawItem(Sender: TCustomListView; Item: TListItem;
Rect: TRect; State: TOwnerDrawState);
begin//如果modi是偶数就把背景设为蓝色
if ( modi mod 2 = 0) then lv1.Canvas.Brush.Color:=clblue else
//如果不是偶数就把背景设为红色
lv1.Canvas.Brush.Color:=clred; lv1.Canvas.FillRect(rect);
end;---------谢谢!!
我想为listview控件在添加每个item时,设置不同的背景颜色,但不能生效????!
代码如下 :
procedure TForm1.LV1DrawItem(Sender: TCustomListView; Item: TListItem;
Rect: TRect; State: TOwnerDrawState);
begin//如果modi是偶数就把背景设为蓝色
if ( modi mod 2 = 0) then lv1.Canvas.Brush.Color:=clblue else
//如果不是偶数就把背景设为红色
lv1.Canvas.Brush.Color:=clred; lv1.Canvas.FillRect(rect);
end;---------谢谢!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货