//显示图片 private void Lv1_Click(object sender, EventArgs e) { int id = Convert.ToInt32(Lv1.SelectedItems[0].Text); RepastBLL.wordsManager w = new RepastBLL.wordsManager(); RepastModel.Coursedetails ccc = w.picbyid(id); string pic1 = ccc.Cd_right_pic.ToString(); string pic2 = ccc.Cd_wrong_pic1.ToString(); string pic3 = ccc.Cd_wrong_pic2.ToString(); string pic4 = ccc.Cd_wrong_pic3.ToString(); pictureBox1.Image = Image.FromFile(pic1); pictureBox2.Image = Image.FromFile(pic2); pictureBox3.Image = Image.FromFile(pic3); pictureBox4.Image = Image.FromFile(pic4); }
private void button1_Click(object sender, EventArgs e) { try { RepastModel.Coursedetails cd = new RepastModel.Coursedetails(); RepastBLL.wordsManager wm = new RepastBLL.wordsManager(); cd.Cd_id = int.Parse(textBox1.Text); cd.C_id = int.Parse(tB1.Text); cd.Cd_name = tB2.Text; cd.Cd_yinbiao = tB3.Text; cd.Cd_mean = tB4.Text; cd.Cd_sentence = textBox2.Text; cd.Cd_right_pic = pictureBox1.ImageLocation; cd.Cd_wrong_pic1 = pictureBox2.ImageLocation; cd.Cd_wrong_pic2 = pictureBox3.ImageLocation; cd.Cd_wrong_pic3 = pictureBox4.ImageLocation; int num = wm.InsertCouresDetails(cd); if (num > 0) { MessageBox.Show("添加单词成功!!!"); //GuanLiMain gl = new GuanLiMain(); //gl.DanCiInitialze(); this.Close(); dc d = new dc(); d.dcx(); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }