private void button1_Click(object sender, EventArgs e)
{
OpenFileDialog lvse = new OpenFileDialog();
lvse.Title = "选择图片";
lvse.InitialDirectory = "";
lvse.Filter = "(*.*)|*.*";
if (lvse.ShowDialog() == DialogResult.OK)
{
Image imge = Image.FromFile(lvse.FileName);
Graphics g = richTextBox1.CreateGraphics(); //这句是关键哦
g.DrawImage(imge, 0, 0);
richTextBox1.Clear();
}
}
这边可以打开文件并显示在Richtextbox里,程序可以直接运行只需加上button1,richTextBox1控件