Esempio n. 1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            if (!CheckInputValue())
            {
                return;
            }

            PadInfo newInfo = new PadInfo();

            newInfo.Width  = landWidth;
            newInfo.Height = landHeight;
            newInfo.Shape  = shape;

            int  count     = listBoxMyStandard.Items.Count;
            bool existFlag = false;

            for (int i = 0; i < count; i++)
            {
                if (newInfo.Equals((PadInfo)(listBoxMyStandard.Items[i])))
                {
                    existFlag = true;
                    break;
                }
            }
            if (existFlag)
            {
                return;
            }


            int index = listBoxMyStandard.SelectedIndex;

            if (index < 0)
            {
                index = 0;
            }
            listBoxMyStandard.Items.Insert(index, newInfo);
            listBoxMyStandard.SelectedIndex = -1;
        }