Ejemplo n.º 1
0
        //---
        protected void addInsert(int ind)
        {
            if (icons.getICOcount() == 127)
            {
                MessageBox.Show("127 is the maximum number of icons.",
                                "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            int it = ind;

            if (ind < 0)
            {
                it = listBoxIcons.Items.Count;
            }
            string  t = "ICO_" + it.ToString();
            IcoName f = new IcoName(t);

            if (f.ShowDialog() == DialogResult.OK)
            {
                t = f.icoName;

                int err = icons.isGoodName(t);
                if (err < 0)
                {
                    ICO ic = new Designer2.ICO(t);
                    ic.eventSelectedIndex_Change += new ICO.selectedIndex_Change(itemSelIndChange);
                    if (ind < 0)
                    {
                        icons.add(ic);
                        listBoxIcons.SelectedIndex = listBoxIcons.Items.Count - 1;
                    }
                    else
                    {
                        icons.insert(ind, ic);
                        listBoxIcons.SelectedIndex = ind;
                    }
                    return;
                }
                string[] errTab = { "The name must have at least one character.",
                                    "The first character of the name must be '_' or a letter.",
                                    "Permissible characters are letters, numbers or '_'.",
                                    "The name must be unique. This name already exists." };
                MessageBox.Show(errTab[err],
                                "Error.",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Ejemplo n.º 2
0
        //---
        private void menuIconChangeName_Click(object sender, EventArgs e)
        {
            {
                IcoName f = new IcoName(textBoxName.Text);
                string  t = "";
                if (f.ShowDialog() == DialogResult.OK)
                {
                    t = f.icoName;

                    if (t == textBoxName.Text)
                    {
                        return;
                    }
                    int err = icons.isGoodName(t);
                    if (err < 0)
                    {
                        int i = listBoxIcons.SelectedIndex;
                        if (i < 0)
                        {
                            MessageBox.Show("No Icon has been selected for renaming.",
                                            "Error.",
                                            MessageBoxButtons.OK,
                                            MessageBoxIcon.Error);
                            return;
                        }
                        icons[i].Name = t;
                        actualizeIcon(sender, e);
                        listBoxIcons.SelectedIndex = i;

                        return;
                    }
                    string[] errTab = { "The name must have at least one character.",
                                        "The first character of the name must be '_' or a letter.",
                                        "Permissible characters are letters, numbers or '_'.",
                                        "The name must be unique. This name already exists." };
                    MessageBox.Show(errTab[err],
                                    "Error.",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }