0

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

提前致谢,

4

1 回答 1

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;
            }
        }
于 2012-12-09T03:38:45.673 回答