2010-02-19 103 views
1

我創建了一些控件,並且我定義了一些可以在設計時定義但只顯示一個的屬性。 另一個問題是,在顯示的一箇中,表單的文本框已顯示,但我無法選擇任何。通過自定義控件提供屬性設計時間(.NET)

[Description("Blah Blah Blah"), 
    Category("Data"),    
    DefaultValueAttribute(typeof(TextBox), null), 
    Browsable(true)] 
    //Only show this one 
    public TextBox textBox 
    { 
     set { txt = value;} 
    } 


    [Description("Blah blah blah again"), 
    Category("Data"), 
    DefaultValueAttribute(typeof(string), null), 
    Browsable(true)] 
    public string Mensaje 
    { 
     set { sMensaje = value; } 
    } 

那麼,什麼是錯我的代碼

回答

6

你的屬性丟失干將。

// Snip attributes 
public TextBox textBox 
{ 
    get { return txt; } 
    set { txt = value;} 
} 

// Snip attributes 
public string Mensaje 
{ 
    get { return sMensaje; } 
    set { sMensaje = value; } 
} 
相關問題