How can i apply bitmap for a button using c#.net

private void button2_Click(object sender, EventArgs e)
    {
      this.button2.BackgroundImage = Image.FromFile(@"C:\picture.bmp");
    }

This is fine.But is there any way to store the bitmap in Resources of the project itself as we do in vc++.

Now i got how to include bitmap into the resources but how do i attach this particular bitmap which i created in the resources to the Button?.(I do not want to give any filepath)

Under your "Properties" folder in the solution explorer you will see a file called "Resources.resx". Double click on it. Then in that window click on "Add File -- Existing File" and select your image and it will embed it.

To access that image from code use Properties.Resources.<FileName>

Its working.Thank you so much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.