如何TListView中显示不同颜色和字体? 在ViewStyle=vsReport的情况下,希望显示不同颜色的字体。在ListView1CustomDrawSubItem事件中可以控制,但怎么样得到Item.SubItems显示的位置呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 方法如下,不需要得到Item.SubItems显示的位置,因为ListView会自动画,你只需要设置好画布就行了:procedure TForm1.ListView1CustomDrawSubItem(Sender: TCustomListView; Item: TListItem; SubItem: Integer; State: TCustomDrawState; var DefaultDraw: Boolean);begin case SubItem of 1: begin ListView1.Canvas.Font.Color := clBlue; ListView1.Canvas.Font.Name :='宋体'; end; 2: begin ListView1.Canvas.Font.Color := clRed; ListView1.Canvas.Font.Name :='黑体'; end; else begin ListView1.Canvas.Font.Color := clBlack; ListView1.Canvas.Font.Name :='仿宋体'; end; end;end; 如何判断dbgrideh当前行的表中表(嵌套表格)是否打开 我是一个自学的者,怎么提高用函数来写程序。 怎么读入配置文件中的rgb颜色值 sql執行是不出錯,delphi調用時報錯,重複索引 delphi 操作Excelsheet问题 网站后台 Delphi 7 有什么补丁吗? 都用3年了。 求一段简单的代码:能在页面用脚本调用一个函数..... 怎样实现如XP左下边的‘文件和文件夹任务’‘其它位置’‘详细信息’那样可以伸展的功能? DLL中的Form问题 水晶报表 动态创建多个控件,在释放控件时产生错误'List index out of bounds(4)',高手请进来看看!
procedure TForm1.ListView1CustomDrawSubItem(Sender: TCustomListView;
Item: TListItem; SubItem: Integer; State: TCustomDrawState;
var DefaultDraw: Boolean);
begin
case SubItem of
1:
begin
ListView1.Canvas.Font.Color := clBlue;
ListView1.Canvas.Font.Name :='宋体';
end;
2:
begin
ListView1.Canvas.Font.Color := clRed;
ListView1.Canvas.Font.Name :='黑体';
end;
else
begin
ListView1.Canvas.Font.Color := clBlack;
ListView1.Canvas.Font.Name :='仿宋体';
end;
end;
end;