Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't ToolboxBitmapAttribute work?

I have a UserControl in my project called 'UIWizard.cs', and a 24-bit Bitmap named 'UIWizardToolboxBitmap.bmp' that has it's build action set to 'Embedded Resource'. I verified that it does exist in the manifest:

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

I have 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 set my library to 'Release Build' and reference it in another project and add the ToolBox items manually using Choose Items... it still fails to display my bitmap properly. I want to avoid using a absolute path, because this is a source controlled project, and not everyone will be using the same mappings.

MSDN really isn't much help as the documentation on the ToolBoxBitmapAttribute is lacking, and most of what's on the web is pretty vague.

like image 287
David Anderson Avatar asked Aug 13 '10 22:08

David Anderson


1 Answers

It is all bitmap format.
1. If I remember right we are used 256 colors, 16x16 73DPI bitmap.
2. Also try to add [ToolBoxItem(true)] to your class

like image 51
Sergey Mirvoda Avatar answered Nov 08 '22 19:11

Sergey Mirvoda