Toolbox icon for User Control

J

Jim Wilson

I have been able to do this successfully. Be sure that the bitmap has a
build-action of "Embedded Resource" and that the bitmap name exactly matches
the class name.

The key thing is that the bitmap must match the class name exactly including
the namespace. If you are using a separate design project as described in
the article you reference, this is going to give you a problem. VS.NET
automatically prepends the project default namespace to the bitmap name.
The default namespace defaults to the project name. This may be a problem
as the design project has a slightly different name then the runtime
project.

For example:
Runtime VS.NET Project: MyProject
Class Name: MyProject.MyClass
Design VS.NET Project Name: MyProject.Design
BitMap name in VS.NET Design Project: Foo.bmp
Bitmap name in design assembly: MyProject.Design.MyClass.bmp
-- This creates a problem because the bitmap needs the name:
MyProject.MyClass.bmp --

In the above example, setting the design projects default namespace to
"MyProject" rather then "MyProject.Design" should fix the problem.

The easiest way to check the name of the bitmap within the assembly is to
run ILDASM and open the Manifest. The embedded resources are listed at the
end of the manifest.

Jim Wilson, eMVP
http://www.jwhh.com
http://www.develop.com
 

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

Top