DELPHI隐藏有一个设置控件属性的函数你在网上找找相关的代码, 下面这个是给delphi的treeView加上CheckBox的, 你的问题和这个有点相似, 但要自己研究了。procedure 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; 新版的WIN公共控件的TREEVIEW中有DELPHI中没有的风格定义 const TVS_CHECKBOXES = $0100; 用下面的语句既可给TTREEVIEW加CHECKBOX SetComCtlStyle(TTreeView1,TVS_CHECKBOXES,True);
下面这个是给delphi的treeView加上CheckBox的,
你的问题和这个有点相似,
但要自己研究了。procedure 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;
新版的WIN公共控件的TREEVIEW中有DELPHI中没有的风格定义
const
TVS_CHECKBOXES = $0100;
用下面的语句既可给TTREEVIEW加CHECKBOX
SetComCtlStyle(TTreeView1,TVS_CHECKBOXES,True);
http://www.mscto.com/delphi/200811177395.html