Why doesn't ToolboxBitmapAttribute work?

I have a UserControl in my project called "UIWizard.cs" and a 24-bit bitmap called "UIWizardToolboxBitmap.bmp" that has a build action set to "Embedded Resource". I checked that it exists in the manifest:

.mresource public BitFlex.Windows.Forms.Resources.UIWizardToolboxBitmap.bmp { // Offset: 0x00000000 Length: 0x00000336 } 

I tried these attribute declarations:

 [ToolboxBitmap(typeof(UIWizard), "BitFlex.Windows.Forms.Resources.UIWizardToolboxBitmap.bmp")] public partial class UIWizard : UserControl { [ToolboxBitmap(typeof(UIWizard), "UIWizardToolboxBitmap.bmp")] public partial class UIWizard : UserControl { [ToolboxBitmap(typeof(UIWizard), "UIWizardToolboxBitmap")] public partial class UIWizard : UserControl { 

When I install my library in "Release Build" and reference it in another project and manually add ToolBox elements using "Select Elements" ... it still cannot correctly display my bitmap. I want to avoid using an absolute path, because this is a project with a controlled source, and not everyone will use the same mappings.

MSDN really doesn’t really help, because the documentation for the ToolBoxBitmapAttribute is missing, and most of what is pretty vague on the Internet.

+7
c # embedded-resource toolbox
source share
1 answer

This is all a raster image format.
1. If I remember correctly, we use 256 colors, a bitmap 16x16 73DPI.
2. Also try adding [ ToolBoxItem (true)] to your class

+2
source share

All Articles