为什么 ToolboxBitmapAttribute 不起作用?

发布于 2024-09-14 03:45:53 字数 870 浏览 2 评论 0原文

我的项目中有一个名为“UIWizard.cs”的 UserControl,以及一个名为“UIWizardToolboxBitmap.bmp”的 24 位位图,其构建操作设置为“嵌入式资源”。我验证了它确实存在于清单中:

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

我尝试了这些属性声明:

[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 {

当我将库设置为“发布构建”并在另一个项目中引用它并使用手动添加工具箱项时选择项目...它仍然无法正确显示我的位图。我想避免使用绝对路径,因为这是一个源代码控制项目,并不是每个人都会使用相同的映射。

MSDN 确实没有多大帮助,因为缺少有关 ToolBoxBitmapAttribute 的文档,而且网络上的大多数内容都非常模糊。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鹿港小镇 2024-09-21 03:45:53

都是位图格式。
1. 如果我没记错的话,我们使用的是 256 色、16x16 73DPI 位图。
2. 另请尝试将 [ToolBoxItem(true)] 添加到您的班级

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文