unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls; type TForm1 = class(TForm) TreeView1: TTreeView; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } procedure SetComCtlStyle(Ctl: TWinControl; Value: Integer; UseStyle: Boolean); public { Public declarations } end; const TVS_CHECKBOXES=$0100; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.SetComCtlStyle(Ctl: TWinControl; Value: Integer; UseStyle: Boolean); var Style: Integer; begin if Ctl.HandleAllocated then begin Style := GetWindowLong(Ctl.Handle, GWL_STYLE); if not UseStyle then Style := Style and not Value else Style := Style or Value; SetWindowLong(Ctl.Handle, GWL_STYLE, Style); end; end; procedure TForm1.Button1Click(Sender: TObject); begin SetComCtlStyle(TreeView1,TVS_CHECKBOXES,True); end; end.