2012-12-02 34 views
0

如何將圖標添加到我的自定義組件,以顯示在工具箱上? 我有組件設計在VB中,我應該先做一些DLL或ActiveX? (I preffer不因爲我仍然深化發展)預先vb .net自定義組件圖標

謝謝,

+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; 
      } 
     }