Pirahnaplant
Well-known member
- Joined
- Mar 29, 2009
- Messages
- 75
- Programming Experience
- 3-5
How can I make my UserControl not have the resizing handles when placed on a form in design mode; similar to a label or a textbox?
Friend Class LabelDesigner
Inherits ControlDesigner
' Methods
Public Sub New()
MyBase.AutoResizeHandles = True
End Sub
' Properties
Public Overrides ReadOnly Property SelectionRules() As SelectionRules
Get
Dim _selectionRules As SelectionRules = MyBase.SelectionRules
Dim component As Object = MyBase.Component
Dim descriptor As PropertyDescriptor = TypeDescriptor.GetProperties(component).Item("AutoSize")
If ((Not descriptor Is Nothing) AndAlso CBool(descriptor.GetValue(component))) Then
_selectionRules = (_selectionRules And Not SelectionRules.AllSizeable)
End If
Return _selectionRules
End Get
End Property
End Class
'(the code for text alignment snaplines was removed)
Imports System.Windows.Forms.Design
Imports System.ComponentModel
<Designer(GetType(LabelDesigner))> _
Public Class UserControl1