示例#1
0
文件: Classes.cs 项目: skrishnau/LMS
        private void HideComboBox()
        {
            if (this.m_CurrentNode != null)
            {
                // Unregister the event listener
                this.m_CurrentNode.ComboBox.SelectedIndexChanged -=
                    ComboBox_SelectedValueChanged;
                //this.m_CurrentNode.ComboBox.DropDownClosed -=
                //                     ComboBox_DropDownClosed;

                // Copy the selected text from the ComboBox to the TreeNode
                this.m_CurrentNode.Text = this.m_CurrentNode.ComboBox.Text;

                // Hide the ComboBox
                this.m_CurrentNode.ComboBox.Visible = false;
                //this.m_CurrentNode.ComboBox.DroppedDown = false;

                // Remove the control from the TreeView's
                // list of currently-displayed controls
                this.Controls.Remove(this.m_CurrentNode.ComboBox);

                // And return to the default state (no ComboBox displayed)
                this.m_CurrentNode = null;
            }
        }
示例#2
0
文件: Classes.cs 项目: skrishnau/LMS
        protected override void OnTreeNodeExpanded(TreeNodeEventArgs e)
        {
            // Are we dealing with a dropdown node?
            if (e.Node is DropDownTreeNode)
            {
                this.m_CurrentNode = (DropDownTreeNode)e.Node;

                // Need to add the node's ComboBox to the
                // TreeView's list of controls for it to work
                this.Nodes.Add(this.m_CurrentNode);

                // Set the bounds of the ComboBox, with
                // a little adjustment to make it look right
                //this.m_CurrentNode.ComboBox.(
                //    this.m_CurrentNode.Bounds.X - 1,
                //    this.m_CurrentNode.Bounds.Y - 2,
                //    this.m_CurrentNode.Bounds.Width + 25,
                //    this.m_CurrentNode.Bounds.Height);

                // Listen to the SelectedValueChanged
                // event of the node's ComboBox
                this.m_CurrentNode.ComboBox.SelectedIndexChanged +=
                    new EventHandler(ComboBox_SelectedValueChanged);
                //this.m_CurrentNode.ComboBox.DropDownClosed +=
                //   new EventHandler(ComboBox_DropDownClosed);

                // Now show the ComboBox
                this.m_CurrentNode.ComboBox.Visible = true;
                //this.m_CurrentNode.ComboBox.DroppedDown = true;
            }
            base.OnTreeNodeExpanded(e);
        }