关于TreeView的问题?!!!!!
我想自定义一个TreeView的节点输出文本的样式,在用下面的代码实现这个功能后,出现一个问题,就是:当选择了这个节点下面一个节点后,紧随着再选择这个节点,则先选择的那个节点的样式就回不到原来的样式,有一台电脑是会变大,有一台电脑上是变成粗体,各位大侠帮忙看一看出错在哪里。
procedure TFodagl.TVCustomDrawItem(Sender: TCustomTreeView;
Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
begin
with tv.Canvas do
begin
if node.Text='系统用户管理员' then
begin
font.Color:=clred;
// font.Style:=[fsbold];
// brush.Color:=clblue;
end;
defaultdraw:=true;
if defaultdraw then
if cdsselected in state then
if node.Text='系统用户管理员' then
begin
font.Color:=clyellow;
// font.Style:=font.Style+[fsitalic];
brush.Color:=clgreen;
fillrect(node.DisplayRect(true));
end;
end;
end;