コード例 #1
0
        private void LoadType(KellNode node)
        {
            if (node != null)
            {
                loadover = false;

                this.SuspendLayout();
                comboBox1.Items.Clear();
                subComboBoxs.Clear();
                this.Controls.RemoveByKey("SubCombo");
                List <KellNode> types = node.GetSub();
                foreach (KellNode type in types)
                {
                    comboBox1.Items.Add(type);
                }
                if (comboBox1.Items.Count > 0)
                {
                    comboBox1.SelectedIndex = 0;
                }

                if (addNewType)
                {
                    comboBox1.Items.Add(NewItemString);
                }
                //SetSubType(types);
                this.ResumeLayout(true);

                loadover = true;
            }
        }
コード例 #2
0
 private void Goto()
 {
     if (this.node != null)
     {
         KellNode node = this.node.GetNodeByFullPath(comboBox1.Text);
         if (node != null)
         {
             listBox1.Items.Clear();
             listBox1.Items.AddRange(node.GetSub().ToArray());
             comboBox1.Text = node.FullPath;
             this.node      = node;
         }
         if (node.IsRoot)
         {
             button6.Enabled = false;
         }
         else
         {
             button6.Enabled = true;
         }
     }
 }
コード例 #3
0
        private void LoadSubType(ComboBox combo)
        {
            if (combo.SelectedItem == null)
            {
                return;
            }

            if (!(combo.SelectedItem.GetType().Equals(Type)))
            {
                combo.Visible = false;
                int level = subComboBoxs.IndexOfComboBox(combo);
                for (int i = level; i < subComboBoxs.Count; i++)
                {
                    subComboBoxs[i].Combo.Visible = false;
                }
            }
            else
            {
                KellNode parent = (KellNode)combo.SelectedItem;
                int      level  = parent.Level;
                for (int i = subComboBoxs.Count; i < parent.LevelCount - 2; i++)
                {
                    CreateNewComboBoxTip(i);
                }
                for (int i = level - 1; i < subComboBoxs.Count; i++)
                {
                    if (parent != null)
                    {
                        List <KellNode> subs = parent.GetSub();
                        if (subs.Count > 0)
                        {
                            subComboBoxs[i].Combo.Visible = true;
                            subComboBoxs[i].Combo.Items.Clear();
                            foreach (KellNode sub in subs)
                            {
                                subComboBoxs[i].Combo.Items.Add(sub);
                            }
                            subComboBoxs[i].Combo.Items.Add(UpLevelString);
                            if (addNewType)
                            {
                                subComboBoxs[i].Combo.Items.Add(NewItemString);
                            }
                            subComboBoxs[i].Combo.Items.Add(UpLevelString);
                            subComboBoxs[i].Combo.SelectedIndex = 0;
                        }
                        else
                        {
                            subComboBoxs[i].Combo.Visible = false;
                        }
                        List <KellNode> subs1 = parent.GetSub();
                        if (subs1.Count > 0)
                        {
                            parent = subs1[0];
                        }
                        else
                        {
                            parent = null;
                        }
                    }
                }
            }
        }