如果你要修改ListBox的选中文本颜色的话,可以用自画方式。 procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); var s:string; begin s:=(Control as TListbox).Items[Index]; if odSelected in State then listbox1.Canvas.Pen.Color := clRed; DrawText(Handle,PChar(ShowCaption),-1,Rect,DT_LEFT or DT_SINGLELINE or DT_VCENTER); end;
SetBkColor是用来设置控件的背景颜色,SetSysColors就是设置整个系统的所有对象的颜色,
SetTextColor用来设置控件的前景颜色
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState);
var
s:string;
begin
s:=(Control as TListbox).Items[Index];
if odSelected in State then
listbox1.Canvas.Pen.Color := clRed;
DrawText(Handle,PChar(ShowCaption),-1,Rect,DT_LEFT or DT_SINGLELINE or DT_VCENTER);
end;
我试过了,怎么没有用啊,是不是还需要执行其他的函数?
SuiPack, RainXp, RainSkin套装控件都是不错的界面控件,其中就有你要实现的功能的ListView;
我的Email是[email protected]。
对你的热心和耐心表示谢意。