Accessing Bitmap resource

  • Thread starter Thread starter Lee
  • Start date Start date
L

Lee

Visual Studio 2.0 / XP Professional with all service packs

Assume the appropriate Using directives.

The following statements work:

ComponentResourceManager resources = new
ComponentResourceManager(typeof(Resource1));
Bitmap ImageDown = new
Bitmap((Image)(resources.GetObject("ButtonDown")));
Bitmap ImageUp = new
Bitmap((Image)(resources.GetObject("ButtonUp"))));

but:

Bitmap ImageDown = new Bitmap(typeof(Resource1),
"ButtonDown");

throws an exception saying that "ButtonDown" cannot be found in class
'TOSExportClient.Resource1' ('TOSExportClient is the name of the dll).

Looking for the reason that the first form works and the second does
not.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top