uses
CommCtrl;
procedure SetNodeBoldState(Node: TTreeNode; Value: Boolean);
var
TVItem: TTVItem;
begin
if not Assigned(Node) then Exit;
with TVItem do
begin
mask := TVIF_STATE or TVIF_HANDLE;
hItem := Node.ItemId;
stateMask := TVIS_BOLD;
if Value then state := TVIS_BOLD
else
state := 0;
TreeView_SetItem(Node.Handle, TVItem);
end;
end;
// Example: Make the first node bold.
// Beispiel: Erster Eintrag fett machen.
procedure TForm1.Button1Click(Sender: TObject);
begin
SetNodeBoldState(TreeView1.Items[0], True);
end;
|