帮助中说,要将OwnerDraw属性设置成False时,上述两事件才会触发.
可是,我并没有发现这两个事件能够绘画"SubItems"里的东西,包括字体,
背景,色彩等, 既然不能修改SubItem,为什么还要叫"...DrawSubItem()"呢?
请问大家,有谁知道怎么做才能绘画SubItem内容,包括字体/色彩等??
最好附上代码说明, 因为语言还是太难描述了.
可是,我并没有发现这两个事件能够绘画"SubItems"里的东西,包括字体,
背景,色彩等, 既然不能修改SubItem,为什么还要叫"...DrawSubItem()"呢?
请问大家,有谁知道怎么做才能绘画SubItem内容,包括字体/色彩等??
最好附上代码说明, 因为语言还是太难描述了.
解决方案 »
- (急)窗体最小化问题
- 能不能单击“用Canvas动态画的线”,从而产生单击事件
- rave当中控件显示
- 如何使窗体不出现在下边的任务栏上?
- 请教各位,如果我想在listbox或richedit中单独改变第二行数据的字体颜色,该怎么做??
- 请问怎样在程序中调用winzip?
- query1.sql.add('insert into DKH valus(select fname,fXH from users where usercode='free')');怎么不可以呀?好象问题就出在引号上了,
- 100分求知Delphi.Net Preview版的下载地址!!!!!!
- 五百分求购像QQ一样可以在广域中聊天的源码!
- 请问如何将windows帮助文件hlp,chm转换为完整的html文件,有工具吗?
- 如何用打印指令操作并口打印机的打印
- 三层系统中怎样取得登录的用户名和时间?
procedure TForm1.ListView1AdvancedCustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage;
var DefaultDraw: Boolean);
begin
if Odd(Item.Index) then begin
Sender.Canvas.Font.Color := clRed;
Sender.Canvas.Brush.Color := clBlue;
end;
end;procedure TForm1.ListView1AdvancedCustomDrawSubItem(
Sender: TCustomListView; Item: TListItem; SubItem: Integer;
State: TCustomDrawState; Stage: TCustomDrawStage;
var DefaultDraw: Boolean);
begin
if Odd(Item.Index) then begin
Sender.Canvas.Font.Color := clRed;
Sender.Canvas.Brush.Color := clBlue;
end;
if Odd(SubItem) then
Sender.Canvas.Font.Style := [fsBold];
end;
begin
case Pred (SubItem) of
0:
begin
if 0 = CompareText ('11', Item.SubItems.Strings[Pred (SubItem)]) then
begin
Font.Color := clRed;
Font.Style := [fsBold];
end
else if 0 = CompareText ('21', Item.SubItems.Strings[Pred (SubItem)]) then
begin
Font.Color := clLime;
Font.Style := [fsBold];
end
else if 0 = CompareText ('31', Item.SubItems.Strings[Pred (SubItem)]) then
begin
Font.Color := clHotLight;
Font.Style := [fsBold];
end;
end;
1:
begin
if 0 = CompareText ('12', Item.SubItems.Strings[Pred (SubItem)]) then
begin
Font.Color := clLime;
Font.Style := [fsBold];
end else
if 0 = CompareText ('22', Item.SubItems.Strings[Pred (SubItem)]) then
begin
Font.Color := clRed;
Font.Style := [fsBold];
end else
if 0 = CompareText ('32', Item.SubItems.Strings[Pred (SubItem)]) then
begin
Font.Color := clSkyBlue;
Font.Style := [fsBold];
end;
end;
2:
begin
if 0 = CompareText ('13', Item.SubItems.Strings[Pred (SubItem)]) then
begin
Font.Color := clYellow;
Font.Style := [fsBold];
end;
if 0 = CompareText ('23', Item.SubItems.Strings[Pred (SubItem)]) then
begin
Font.Color := clLime;
Font.Style := [fsBold];
end;
if 0 = CompareText ('33', Item.SubItems.Strings[Pred (SubItem)]) then
begin
Font.Color := clFuchsia;
Font.Style := [fsBold];
end;
end;
else
Font.Color := clHighLight;
end;
end;
搞定!