private void mniInsertImage_Click(object sender, EventArgs e) { OpenFileDialog vOpenDlg = new OpenFileDialog(); vOpenDlg.Filter = "图像文件|*.bmp; *.jpg; *.jpeg; *.png|Windows Bitmap|*.bmp|JPEG 文件|*.jpg; *.jpge|可移植网络图形|*.png"; FEmrView.Enabled = false; try { if (vOpenDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (vOpenDlg.FileName != "") { HCRichData vTopData = FEmrView.ActiveSectionTopLevelData() as HCRichData; HCImageItem vImageItem = new HCImageItem(vTopData); vImageItem.LoadFromBmpFile(vOpenDlg.FileName); vImageItem.RestrainSize(vTopData.Width, vImageItem.Height); Application.DoEvents(); FEmrView.InsertItem(vImageItem); } } } finally { FEmrView.Enabled = true; } }
private void mniInsertImage_Click(object sender, EventArgs e) { OpenFileDialog vOpenDlg = new OpenFileDialog(); vOpenDlg.Filter = "bmp文件|*.bmp"; if (vOpenDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (vOpenDlg.FileName != "") { HCImageItem vImageItem = new HCImageItem(FEmrView.ActiveSectionTopLevelData()); vImageItem.LoadFromBmpFile(vOpenDlg.FileName); FEmrView.InsertItem(vImageItem); } } }
private void 图片ToolStripMenuItem_Click(object sender, EventArgs e) { using (OpenFileDialog vOpenDlg = new OpenFileDialog()) { vOpenDlg.Filter = "图像文件|*.bmp"; if (vOpenDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (vOpenDlg.FileName != "") { HCCustomRichData vTopData = FHCView.ActiveSectionTopLevelData(); HCImageItem vImageItem = new HCImageItem(vTopData); vImageItem.LoadFromBmpFile(vOpenDlg.FileName); vImageItem.RestrainSize(vTopData.Width, vImageItem.Height); Application.DoEvents(); FHCView.InsertItem(vImageItem); } } } }