Although set a certain value, but always automatically changed to another value, such as the width is set to 100, but run or reopen the form design interface, the width automatically becomes 133, such as more open several times, or even become larger, looking for a long time, also can not find the reason, after many attempts to find the reason before for the easy, When setting a custom property, use the following format:
<Category("MAX Member")> _
Public Property mShowControlLength As Integer
Get
Return xShow.Width
End Get
Set(value As Integer)
xShow.Width = value
End Set
End Property
Theoretically, there is no problem, but it will cause this value can not be fixed, even bigger, and later changed to the following format, finally fixed:
<Category("MAX Member")> _
Public Property mShowWidth As Integer
Get
Return _showWidth' Use a custom variable to output a set value
End Get
Set(value As Integer)
_showWidth = value
xShow.Width = _showWidth
If (Me.DesignMode) Then
xItemPanel.Refresh()
End If
End Set
End Property
cause analysis, because the controls in the control themselves do not store the set values, then when the width is obtained, it isprogrambased on the current situation, the width of the calculation is unpredictable, so it is displayed as a random, large value, and then saved as a set value based on this value. That's what happened, take this lesson and don't do it again .
Custom properties are set to control the width or height of the control, but the data is not normal