Beispiel #1
0
 /// <summary>
 /// 创建事件
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnCreat(CreatNodeEventArgs e)
 {
     if (Creat != null)
     {
         Creat(this, e);
     }
 }
Beispiel #2
0
        /// <summary>
        /// OK 按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtName.Text == "")
            {
                MessageBox.Show("节点名不可为空", "提示");
                return;
            }
            int type = -1;
            ComSkin skin = null;
            if (tabControl1.SelectedIndex == 0)
            {
                if (radButton.Checked == true)
                {
                    type = (int)NodeTypeEnum.Button;
                }
                else if (radF9BitMap.Checked == true)
                {
                    type = (int)NodeTypeEnum.F9BitMap;
                }
                else if (radSelectButton.Checked == true)
                {
                    type = (int)NodeTypeEnum.SelectButton;
                }
                else if (radPanel.Checked == true)
                {
                    type = (int)NodeTypeEnum.Panel;
                }

                else if (radlist.Checked == true)
                {
                    type = (int)NodeTypeEnum.List;
                }
            }
            else if (tabControl1.SelectedIndex == 1)
            {
                skin = setting.SkinList[cmbComType.SelectedIndex];
            }

            CreatNodeEventArgs ce = new CreatNodeEventArgs(type, txtName.Text, skin);
            OnCreat(ce);
        }
        /// <summary>
        /// 创建节点回调
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void creatNodeFrom_Creat(object sender, CreatNodeEventArgs e)
        {
            string nodeName = e.NodeName;
            int type = e.Type;
            ComSkin skin = e.Skin;
            if (checkNodeExist(nodeName))
            {
                MessageBox.Show("同名节点已存在", "提示");
                return;
            }
            else
            {
                creatNodeFrom.Close();
                if (type != -1)
                {
                    creatNode(type, nodeName);
                }
                else
                {
                    creatNode(skin,nodeName);
                }

                refreshSkinTree();
                selectLstSkinItem(nodeName);
            }
        }