private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult dlg = this.saveFileDlg.ShowDialog(); if (dlg == DialogResult.OK) { frmPicture frm = this.ActiveMdiChild as frmPicture; try { Image img = frm.pbHinh.Image; img.Save(saveFileDlg.FileName, ImageFormat.Bmp); } catch { MessageBox.Show("Lỗi lưu file"); } } }
private void newToolStripMenuItem_Click(object sender, EventArgs e) { try { DialogResult dlg = this.OpenFileDlg.ShowDialog(); if (dlg == DialogResult.OK) { frmPicture frm = new frmPicture(OpenFileDlg.FileName); frm.MdiParent = this; count++; frm.Text = "Picture -" + count + "-" + OpenFileDlg.FileName; frm.Show(); } this.toolStripStatusLabel1.Text = "Tổng số Form con: " + count.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }