Bold style for TreeView items

Posted in Components

Add CommCtrl string in uses chapter and use TV_ITEM structure for setting attributes of TreeView items.

uses
  CommCtrl;
...
procedure TForm1.TreeView1GetSelectedIndex(Sender: TObject;
  Node: TTreeNode);
var
  Item: TTVItem;
begin
  FillChar(Item, Sizeof(Item), 0);
  Item.hItem:=Node.ItemId;
  Item.Mask:=TVIF_STATE;
  Item.StateMask:=TVIS_BOLD or TVIS_CUT;
  Item.State:=TVIS_BOLD;
  TreeView_SetItem(Node.Handle, Item);
end;