vb .net自定义组件图标

时间:2012-12-02 22:40:03

标签: .net vb.net

如何在自定义组件中添加图标,以便在工具箱中显示? 我有用vb设计的组件,我应该先制作一些dll还是activex? (因为我还在继续发展,所以我不喜欢)

提前致谢,

1 个答案:

答案 0 :(得分:1)

 // [ToolboxBitmap(typeof(TextBox))]  // set default icons
    [ToolboxBitmap(@"C:\Documents and Settings\Joe\MyPics\myImage.bmp")]  // set own icons

示例覆盖文本框:

private bool IsNum = true;

[ToolboxBitmap(typeof(TextBox))] 
        [PropertyTab("IsNumaric")]
        [DisplayName("IsNumaricTextBox")]
        [Category("EmsoftBehaviors")]
        [Description("If this is 'True' then textbox accept only numbers")]
        public bool IsNumaricTextBox
        {
            set
            {
                IsNum = value;
            }
            get
            {
                return IsNum;
            }
        }