我有一个用户控件来覆盖属性Text.但这个属性在设计时没有显示.
如果我将其重命名为标题或值,它将在设计时显示在属性中,但不显示文本.
public Class SomeControl Inherits System.Windows.Forms.UserControl Public Overrides Property Text() As String Get Return lblText.Text End Get Set(ByVal value As String) lblText.Text = value End Set End Property End Class
该怎么办?
添加以下属性,问题解决.
<EditorBrowsable(EditorBrowsableState.Always)> _ <Browsable(True)> _ <DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)> _ <Bindable(True)> _ Public Overrides Property Text() As String Get Return lblText.Text End Get Set(ByVal value As String) lblText.Text = value End Set End Property