返回首页

您好

我有一个在我的Windows应用程序的PictureBox。我有一个解决方案资源管理器文件夹名称的文件夹图片。
有下列代码


 

                        

                           Bitmap bmp;

                           string ImagePath = (System.Environment.CurrentDirectory);

                            if (ImagePath.EndsWith("\\bin\\Debug"))

                            {

                                ImagePath = ImagePath.Replace("\\bin\\Debug", "");

                            }

                           ImagePath = ImagePath +"\\Images\\;

                           if (System.IO.File.Exists(ImagePath + dsReSchedule.Tables[0].Rows[0]["AIRLINECODE"].ToString() + ".jpg") == true)

                            {

                                bmp = new Bitmap(Image.FromFile(ImagePath + dsReSchedule.Tables[0].Rows[0]["AIRLINECODE"].ToString() + ".jpg"));

                            }

                            else

                            {

                                bmp = new Bitmap(Image.FromFile(ImagePath + "Noflight" + ".jpg"));

                            }

                            pbxImage.Image = bmp;

 


回答