如题,想要在Button1按下的时候使得ListView中的某一个Item的字体变粗,或者改变字体的颜色等,应该如何做?
解决方案 »
- 菜鸟问关于日期格式的问题!!
- 请教一个编译错误:Declaration differs from declaration?
- 年终放分
- 打印到文本时如何设置显示格式(数字显示成为货币格式)?
- 怎么我的代码捕获不到异常呢?
- 写sql,怎样每到一天,实现一个表中的数据加入另一表
- 80分求助!滚动ScrollBox的Scrollbar,结束滚动时,可以触发什么事件?请高手帮忙!
- CSDN怎么加不成分了?我都试了3、4遍了,迷茫中........
- 为什么在win2000中不能进行自定义打印?
- 之前请教的"Form标题"的问题,我的描述有误,重新来过!
- 加入组件问题
- 有没有玩传奇2私服的啊,我搞了一个,有空来玩玩~
var
Form1: TForm1;
strPos:string;implementation{$R *.dfm}procedure TForm1.ListView1CustomDrawSubItem(Sender: TCustomListView;
Item: TListItem; SubItem: Integer; State: TCustomDrawState;
var DefaultDraw: Boolean);
begin
if Item.SubItems[SubItem-1]=strPos then
begin
ListView1.Canvas.Font.Color:=clred;
ListView1.Canvas.Font.Style:=[fsBold];
end else
ListView1.Canvas.Font.Color:=clBlack;
end;procedure TForm1.BitBtn1Click(Sender: TObject);
begin
strPos:=Edit1.Text;
ListView1.Refresh;
end;procedure TForm1.ListView1CustomDrawItem(Sender: TCustomListView;
Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
if Item.Caption=strPos then
begin
ListView1.Canvas.Font.Color:=clred;
ListView1.Canvas.Font.Style:=[fsBold];
end else
ListView1.Canvas.Font.Color:=clBlack;
end;