![](/img/trans.png)
[英]How can I add a combobox in control designer properties for a WinForms custom control?
[英]How can I create a control with IPAddress properties that can be edited in the designer?
我正在創建一個屬性類型為System.Net.IPAddress
的控件。 設計器將它們顯示為只讀,並且似乎將它們與資源匹配。 有沒有一種方法可以使用戶可以在設計器屬性窗口中編輯這些屬性,而不必打開資源編輯器?
找到了-答案是偽造它:
[Browsable(true)]
[DisplayName("IPAddress")]
public string IPAddressText
{
get { return this.IPAddress.ToString(); }
set { this.IPAddress = IPAddress.Parse(value); }
}
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public IPAddress IPAddress
{
get;
set;
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.