我正在用vb.net開發我自己的userControl。我對這項任務很感興趣。從UserControl中刪除屬性和事件vb.net
我想刪除默認屬性。 谷歌後,我發現了幾個主題,像這樣: Removing certain properties in a user control, i.e. forcing one value and not editable in Design mode
所以,我試圖使用它,但不適用於我。我不知道我錯過了什麼,或者錯了什麼。
Public Class MyControlDesigner
Inherits System.Windows.Forms.Design.ControlDesigner
Protected Overrides Sub PreFilterProperties(ByVal properties As System.Collections.IDictionary)
MyBase.PreFilterProperties(properties)
properties.Remove("BackColor")
properties.Remove("ForeColor")
properties.Remove("Font")
End Sub
End Class
<DesignerAttribute(GetType(MyControlDesigner))> _
Public Class MyUserControl
' ...
End Class
要隱藏覆蓋性能我按照這個話題Hiding inherited properties這工作得很好,對於其中的一些。
<Browsable(False), EditorBrowsable(EditorBrowsableState.Never)> _
Public Shadows Property AutoScroll() As Boolean
Get
Return m_AutoScroll
End Get
Set(ByVal value As Boolean)
m_AutoScroll = value
End Set
End Property
但仍然有其他屬性,我不知道如何隱藏或刪除。像字體,前景色,保證金等等
得益於先進的
編輯:一旦我完成我的控制,我不希望看到的,所有喜歡的圖片屬性,只有我想展示mine'秒。
編輯:從@Plutonix添加代碼
你在嘗試從intellisense,用戶代碼或屬性編輯器中刪除屬性。解釋「它不適合我」的含義。事件不能被刪除;在某些情況下(子分類控制),你可以阻止它們發射,但它們仍然存在 – Plutonix
你在嘗試從intellisense,用戶代碼或屬性編輯器中刪除屬性。我試圖從我的編輯器中刪除,在這種情況下,從WinCC(西門子的Scada) – yaqui