richTextBox 中插入图片
richTextBox中插入表格
网络上基本的方法。
网络上基本的方法。
1
openFileDialog1.Filter = "jpge文件.jpg|*.jpg|bmp文件.bmp|*.bmp|所有文件*.*|*.*";
2
if (openFileDialog1.ShowDialog() == DialogResult.OK)
3
{
4
string filepath = openFileDialog1.FileName;
5
Bitmap bitmap1 = new Bitmap(filepath);
6
Clipboard.SetDataObject(bitmap1);
7
DataFormats.Format FormatImage = DataFormats.GetFormat(DataFormats.Bitmap);
8
if (richTextBox1.CanPaste(FormatImage))
9
{
10
richTextBox1.Paste(FormatImage);
11
}
12
else
13
{
14
MessageBox.Show("内存不足!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
15
}
16
bitmap1.Dispose();
17
}
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
4
![](/Images/OutliningIndicators/InBlock.gif)
5
![](/Images/OutliningIndicators/InBlock.gif)
6
![](/Images/OutliningIndicators/InBlock.gif)
7
![](/Images/OutliningIndicators/InBlock.gif)
8
![](/Images/OutliningIndicators/InBlock.gif)
9
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
10
![](/Images/OutliningIndicators/InBlock.gif)
11
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
12
![](/Images/OutliningIndicators/InBlock.gif)
13
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
14
![](/Images/OutliningIndicators/InBlock.gif)
15
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
16
![](/Images/OutliningIndicators/InBlock.gif)
17
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)