富文本粘贴图片
private void InsertImage(){OpenFileDialog openImageDlg = new OpenFileDialog();openImageDlg.Filter = "所有圖片(*.bmp,*.gif,*.jpg)|*.bmp;*.gif;*jpg";openImageDlg.Title = "選擇圖片";Bitmap bmp;if (openImageDlg.ShowDialog() == DialogResult.OK){string fileName = openImageDlg.FileName;if (null == fileName || fileName.Trim().Length == 0)return;try{bmp = new Bitmap(fileName);Clipboard.SetDataObject(bmp);DataFormats.Format dataFormat =DataFormats.GetFormat(DataFormats.Bitmap);if (curRichTextBox.CanPaste(dataFormat))curRichTextBox.Paste(dataFormat);}catch (Exception exc){MessageBox.Show("圖片插入失敗。" + exc.Message, "提示",MessageBoxButtons.OK, MessageBoxIcon.Information);}}}
轉載于:https://www.cnblogs.com/Areas/archive/2012/11/21/2780633.html
總結
- 上一篇: LUA遇到的问题
- 下一篇: 在brew开发中遇到的一些问题