当前位置:主页>Delphi教程>文章内容
怎么让TreeView前面显示CheckBox
来源: 作者: 发布时间:2007-04-29  

我的主页: http://www.tommstudio.com/

下面的代码可以让Treeview前面显示CheckBox.


const
TVS_CHECKBOXES = $00000100;

procedure SetComCtrlStyle(WinCtrl: TWinControl; Value: Integer; UseStyle: Boolean);
var
Style: Integer;
begin
  if WinCtrl.HandleAllocated then
  begin
    Style := GetWindowLong(WinCtrl.Handle, GWL_STYLE);
    if not UseStyle then
    Style := Style and not Value
    else Style := Style or Value;
    SetWindowLong(WinCtrl.Handle, GWL_STYLE, Style);
  end;
end;


然后 在 OnCreate 调用:


SetComCtrlStyle(TreeView1, TVS_CHECKBOXES, True);



或者干脆简单点,一句话完事:


SetWindowLong(TreeView1.Handle, GWL_STYLE, GetWindowLong(TreeView1.Handle, GWL_STYLE) or $00000100);




 
上一篇:datatree和数据库绑定的最少代码   下一篇:数据表的二维表存储及定位
 
  相关文章
·datatree和数据库绑定的最少代码
·数据表的二维表存储及定位
·Delphi的Hint(2)
·用Delphi实现文件下载的几种方法
·[Delphi版]罗技无限灵貂,驱动程序补丁
·李维看Delphi2006(DeXter)
·ADO方式下判断数据表是否存在
·Delphi中的包(一):关于exe的编译、
·如何根据类的名字来生成对象
·Delphi中的包(三):bpl和dll
·一个导出Excel非常快的类
·如何获取TWebBrowser控件的超级链接
 
【关闭窗口】
推荐本站资源
最新文章