我正在为我的图书馆制作一个自定义表单
Public Class MycustomForm : Inherits Form
Private Const CP_NOCLOSE_BUTTON As Integer = &H200
Private _CloseBox As Boolean = True
Public Sub New()
MyBase.New()
End Sub
<Category("WindowStyle")> _
<DefaultValue(True)> _
<Description("This property enables or disables the close button")> _
Public Property CloseBox As Boolean
Get
Return _CloseBox
End Get
Set(value As Boolean)
If value <> _CloseBox Then
value = _CloseBox
Me.RecreateHandle()
End If
End Set
End Property
Protected Overrides ReadOnly Property CreateParams As CreateParams
Get
Dim CustomParams As CreateParams = MyBase.CreateParams
If Not _CloseBox Then
CustomParams.ClassStyle = CustomParams.ClassStyle Or CP_NOCLOSE_BUTTON
End If
Return CustomParams
End Get
End Property
End Class
我创建了一个属性来为开发人员提供禁用关闭按钮的可能性
当我在设计器中测试我的表单时,我更改了MyForm.Designer
:
Partial Class MyForm
Inherits MycustomForm
之后,属性已添加,当我尝试将属性更改为 时False
,我无法更改它,因为属性没有更改
我究竟做错了什么?