|
获得路径
//获取可执行文件路径及可执行文件名称
string Apppath = System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase;
//获取可执行文件路径所在的文件夹
string pathstr = new FileInfo(Apppath).DirectoryName;
if (条件一)
{
Bitmap bm = new Bitmap(pathstr + @"\fen.jpg"); //显示符合条件一的图片
Image myImage = Image.FromHbitmap(bm.GetHbitmap());
this.pictureBox1.Image = myImage;
}
else
{
Bitmap bm = new Bitmap(pathstr + @"\he.jpg"); //显示其他的图片
Image myImage = Image.FromHbitmap(bm.GetHbitmap());
this.pictureBox1.Image = myImage;
} |
|