我酷下载
您的位置:首页-> 技术文章-> -> Delphi-> 怎么让TreeView前面显示CheckBox

阅读排行




怎么让TreeView前面显示CheckBox

作者未知 来源csdn 加入时间:2005-10-26 人气:678
下面的代码可以让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); 


相关文章

相关软件

联系我们 广告服务 友情链接 版权说明 软件发布 下载帮助

CopyRight
2005-2016 www.5qcn.net All Rights Reserved 版权所有 【我酷】下载