/// <summary> /// 保存按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { if (DateList.Text == "") { MessageBox.Show("请设置日期。"); DateList.Focus(); return; } for (int index = 0; index < tabControl1.TabPages.Count; index++) { if (tabControl1.TabPages[index].Tag != null) { MemoryStream stream = new MemoryStream(); PictureBox pic = tabControl1.TabPages[index].Controls[1] as PictureBox; TextBox box = tabControl1.TabPages[index].Controls[0] as TextBox; pic.Image.Save(stream, ImageFormat.Jpeg); stream.Flush(); MapDBClass.SavePicture(_MapId, _LayerId, _ObjectId, DateList.Text, index + 1, stream.GetBuffer(), box.Text); stream.Close(); stream.Dispose(); stream = null; tabControl1.TabPages[index].Tag = null; } else { TextBox box = tabControl1.TabPages[index].Controls[0] as TextBox; MapDBClass.UpdatePictureComment(_MapId, _LayerId, _ObjectId, DateList.Text, index + 1, box.Text); } } }