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控件
[
本帖最后由 lmyl_623 于 2009-8-14 13:43 编辑 ]