private void Initialize() { ArrayList names = new ArrayList(); names.AddRange(Enum.GetValues(typeof(FilterType))); RootNode = this.autoPlaylistTreeView.Nodes.Find("Root", false).FirstOrDefault(); RootNode.NodeFont = new Font("Miramonte", 11, FontStyle.Bold); criteria = new TreeNodeComboBox("Click here to add a new filter.."); ComboBox imageCombo = criteria.ComboBox; imageCombo.Name = "Criteria"; imageCombo.Items.AddRange(names.ToArray()); imageCombo.SelectedIndex = 0; condition = new TreeNodeComboBox("Click here to add a new condition.."); condition.ComboBox.Name = "Condition"; text_Value = new TreeNodeTextBox("Click here to set a new value.."); TextBox valueText = text_Value.TextBox; text_Value.TextBox.Name = "Value"; }
private void HideTextBox() { if (this.textbox_node != null) { this.textbox_node.TextBox.KeyPress -= TextBox_KeyPress; this.textbox_node.Text = this.textbox_node.Text; this.textbox_node.TextBox.Hide(); this.Controls.Remove(this.textbox_node.TextBox); this.textbox_node = null; } }
protected override void OnNodeMouseClick(TreeNodeMouseClickEventArgs e) { if (e.Node is TreeNodeComboBox) { this.m_CurrentNode = e.Node as TreeNodeComboBox; this.Controls.Add(this.m_CurrentNode.ComboBox); this.m_CurrentNode.ComboBox.SetBounds( this.m_CurrentNode.Bounds.X - 1, this.m_CurrentNode.Bounds.Y - 2, this.m_CurrentNode.Bounds.Width * 2, this.m_CurrentNode.Bounds.Height); this.m_CurrentNode.ComboBox.SelectedValueChanged += new EventHandler(ComboBox_SelectedValueChanged); this.m_CurrentNode.ComboBox.Show(); this.m_CurrentNode.ComboBox.DroppedDown = true; } else if (e.Node is TreeNodeTextBox) { this.textbox_node = (TreeNodeTextBox)e.Node; this.Controls.Add(this.textbox_node.TextBox); this.textbox_node.TextBox.SetBounds( this.textbox_node.Bounds.X - 1, this.textbox_node.Bounds.Y - 2, this.textbox_node.Bounds.Width, this.textbox_node.Bounds.Height); this.textbox_node.TextBox.KeyPress += new KeyPressEventHandler(TextBox_KeyPress); this.textbox_node.TextBox.Show(); SendKeys.Send("{TAB}"); } base.OnNodeMouseClick(e); }