日期:2014-05-17  浏览次数:20842 次

关于工具条按钮加载位图的问题,请高手帮忙Image newFileImage = new Bitmap
在wince下:

我要给工具上的按钮条加载位图,位图在工程的images文件夹下
我代码如下:
  ImageList imageList = new ImageList();

  Image newFileImage = new Bitmap(imagesFolder + "Scan.bmp");//这一句有问题
  imageList.Images.Add(newFileImage);
  this.toolBar.ImageList = imageList;
  Button1.ImageIndex = 0;
  toolBar.Buttons.Add(Button1);
  this.Controls.Add(toolBar); 

可是报:error CS0103: The name 'imagesFolder' does not exist in the current context

不知道在wince下,imagesFolder 该怎么处理,请高手帮忙,谢谢!

------解决方案--------------------
探讨
我这样写的
  public string GetFileName()
  {
   return System.IO.Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase),"/images/Scan.bmp");
  }

可是还是不行啊,我图片放在工程的images文件夹下,为什么还是不行?