//+
        private void button3_Click(object sender, EventArgs e)
        {
            PMSStripLine pca = new PMSStripLine(null);

            pca.Parent = existName;
            pca.Name   = GetNewName("StripLine");
            existName.Add(pca.Name);
            listBox1.Items.Add(pca);
            listBox1.SelectedIndex = listBox1.Items.Count - 1;
        }
 private string GetNewName(string primary)
 {
     for (int i = 0; i < listBox1.Items.Count; i++)
     {
         string newstring = primary + (i + 1).ToString();
         bool   bExist    = false;
         foreach (var child in listBox1.Items)
         {
             PMSStripLine child1 = (PMSStripLine)child;
             if (child1.Name == newstring)
             {
                 bExist = true;
                 break;
             }
         }
         if (!bExist)
         {
             return(newstring);
         }
     }
     return(primary + (listBox1.Items.Count + 1).ToString());
 }
        //-
        private void button4_Click(object sender, EventArgs e)
        {
            try
            {
                if (listBox1.Items.Count <= 0)
                {
                    return;
                }
                PMSStripLine pca = (PMSStripLine)listBox1.SelectedItem;
                existName.Remove(pca.Name);
                int iSelect = listBox1.SelectedIndex;
                listBox1.Items.RemoveAt(iSelect);

                listBox1.SelectedIndex = (iSelect == 0) ? 0 : iSelect - 1;

                button4.Enabled = (listBox1.Items.Count > 0);
            }
            catch
            {
                listBox1.SelectedIndex = -1;
            }
        }