Example #1
0
        private void 添加颜色ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            washmange.sql.Color col = new washmange.sql.Color();
            AddColor colorForm = new AddColor();
            colorForm.ShowDialog();
            if (colorForm.cName == "")
                return;

            col.colorname = colorForm.cName;
            col.cRGB = colorForm.cRGB;
            if (!col.Insert())
            {
                MessageBox.Show("添加失败:" + Mysqlcom.error);
                return;
            }
            Comdata.AllColor = col.GetAll();
            listBox3.Items.Add(colorForm.cName);
        }
Example #2
0
        private void 修改颜色ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listBox3.SelectedIndex < 0)
                return;

            var cData = Comdata.AllColor.Rows[listBox3.SelectedIndex];
            AddColor cColor = new AddColor();
            cColor.cName = cData[1].ToString();
            cColor.cRGB = (int)cData[2];
            cColor.ShowDialog();

            if (cColor.cName == "")
                return;

            if (!sql.Color.Update((int)cData[0], cColor.cName, cColor.cRGB))
            {
                MessageBox.Show("颜色更新失败!");
                return;
            }

            cData[1] = cColor.cName;
            cData[2] = cColor.cRGB;
            listBox3.Items[listBox3.SelectedIndex] = cColor.cName;
        }