コード例 #1
0
        private void InitializeTreeView()
        {
            m_treeView.CheckBoxes = true;
            m_treeView.ImageList  = DefaultImageList.Instance.ImageList;

            m_treeView.NodeMouseClick += new TreeNodeMouseClickEventHandler(this.OnNodeMouseClick);

            m_treeView.DrawMode  = TreeViewDrawMode.OwnerDrawText;
            m_treeView.DrawNode += new DrawTreeNodeEventHandler(
                delegate(object sender, DrawTreeNodeEventArgs e) {
                TreeNodeEx treeNode = e.Node as TreeNodeEx;
                if (treeNode != null)
                {
                    if (!treeNode.CheckBox)
                    {
                        TreeNodeEx.ShowCheckBox(treeNode);
                    }
                }
                e.DrawDefault = true;
            });

            m_treeView.TreeViewExNodesCheckedEvent += new TreeViewExTimesheetDateTreeNodesCheckedEventHandler(
                delegate(TreeViewEx treeView, TreeViewExTimesheetDateTreeNodesCheckedEventArgs e) {
                UpdateCalculations(e.TimesheetDateTreeNodes);
            });

            m_treeView.AfterCheck += new TreeViewEventHandler(
                delegate(object sender, TreeViewEventArgs e) {
                TreeViewEx treeView = (TreeViewEx)sender;
                UpdateCalculations(treeView.GetCheckedTimesheetDateTreeNodes());
            });
        }