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

            pca.Parent = existName;
            pca.Name   = GetNewName("CustomLabel");
            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)
         {
             PMSCustomLabel child1 = (PMSCustomLabel)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;
                }
                PMSCustomLabel pca = (PMSCustomLabel)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;
            }
        }