开发者

Why doesn't ToolboxBitmapAttribute work?

开发者 https://www.devze.com 2023-01-11 18:22 出处:网络
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 exi

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 mapp开发者_开发知识库ings.

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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消