• 为什么ToolboxBitmap总是无效?


    不知道大家有没有发现, 一直以来, 我们在自定义自己的控件的时候都希望自己的控件能带着一个很个性的图标出现在.NET Visual Studio IDE的ToolBox上, 但是很不幸, 尽管我们照着微软的说法来做了, 给我们的控件添加了属性ToolboxBitmap, 但Toolbox上依然只出现一个呆板的齿轮图标...

    原来这一切都是微软的Bug, 在这里有较为详细的说明, 下面就提供该文所说的解决方案:

    1. 在根命名空间外部创建一个叫resfinder的internal class

    2. 用这个resfinder作为你的控件类型名称

    3. 用"<default namespace>.<resourcename>"来指定资源所在位置

    例如:

    internal class resfinder

    {

    }

     

    namespace ToolboxIconDemo

    {

      /// <summary>

      /// Summary description for UserControl1.

      /// </summary>

      [ToolboxBitmap(typeof(resfinder),"Foo.Bitmap1.bmp")]

      public class UserControl1 : System.Windows.Forms.UserControl

      {

  • 相关阅读:
    TensorFlow优化器
    TensorFlow读取csv文件过程
    0126Go时间
    0125GoXML 转换
    0130Go数值解析
    0127Go时间戳
    0131GoURL 解析
    0128Go时间格式化
    0133GoBase64
    0124GoJSON 转换
  • 原文地址:https://www.cnblogs.com/LeoWong/p/1511321.html
Copyright © 2020-2023  润新知