-4

I am getting issue in below line :

 taskbarNotifier2.SetBackgroundBitmap(new Bitmap(GetType(),"skin2.bmp"), Color.FromArgb(247, 247, 247));

Resource 'skin2.bmp' cannot be found in class 'WindowsFormsApplication2.Form1'.

Alicia
  • 1,152
  • 1
  • 23
  • 41
user1555245
  • 125
  • 2
  • 3
  • 12

1 Answers1

2

To use a Bitmap(Image) Resource from the project resources,follow these steps;

  • Open Project Properties in Visual Studio (press Alt+F7).
  • Open the Resources Tab in Project Properties page.
  • In the Resources Tab select Images in the first drop down list.
  • Then select Add Existing Item from the second drop down list.
  • This opens a Openfiledialog asking you to select an image file,go on and select an image file from any of your folders.
  • As you select an image and click on Open Button,the selected image gets added to the large blank area in the Resources Tab,with a thumbnail image.
  • Save the project.

The above steps add an image resource to your project.

Now to access the image resource in your project,use Properties.Resources.(ResourceName),where ResourceName is the name of image (say) that you've added just now. Please note an image resource returns an Image object which you can use anywhere where an Image is required.

To explain the last step(assume you have a PictureBox,and you want to display the image resource in the PictureBox), set the image property of PictureBox to this image resource like this;

pictureBox1.Image=Properties.Resources.(ResourceName);

Make sure to replace (ResourceName) with the name of image you've added just now.

Hope it helps you.

devavx
  • 1,035
  • 9
  • 22