在精简版下Form 中怎么读取一个图片文件到PictureBox?

在精简版下Form 中怎么读取一个图片文件到PictureBox?
---------------------------------------------------------------
在.NET CF下,你可以这样实现:(在Pocket PC 2003, .NET CF 1.0 SP3下测试通过)
假设你要显示的图片和当前程序在同一个目录下,图片名称:cool.jpg

using System.IO;
using System.Reflection;

string myPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
Image img = new Bitmap(myPath + "\\cool.jpg");
this.pictureBox1.Image = img;

Published At
Categories with Web编程
Tagged with
comments powered by Disqus