Hi,
I'm developing an application that allow to the user place controls into a form (like design mode). The problem is that I need that the designer form can't be resized. The .NET documentation says that doing an overrides to the SelectionRules property and return the value that you want allow, avoid this feature (resize the control). Why my code don't works?. Any idea?. See the code for the usercontrol.
[code]
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Windows.Forms.Design
Imports System.Drawing
<Designer(GetType(CFQuebForm))> _
Public Class QForm
Inherits UserControl
#Region " P R O P E R T I E S "
<CategoryAttribute("QüebControl"), Description("Retorna la versión del componente"), Browsable(True)> _
Public ReadOnly Property Version() As String
Get
Return "1.0"
End Get
End Property
Public Sub New()
MyBase.New()
SetStyle(ControlStyles.ResizeRedraw, True)
SetStyle(ControlStyles.Selectable, True)
SetStyle(ControlStyles.SupportsTransparentBackColor, True)
SetStyle(ControlStyles.FixedHeight, True)
setstyle(ControlStyles.FixedWidth, True)
Me.BackColor = Color.White
End Sub
Protected Overrides Sub OnResize(ByVal e As System.EventArgs)
MyBase.Size = New Size(250, 300)
End Sub
End Class
Friend Class CFQuebForm
Inherits ControlDesigner
Public Overrides ReadOnly Property SelectionRules() As System.Windows.Forms.Design.SelectionRules
Get
Return SelectionRules.Locked
End Get
End Property
End Class
[/code]
Like you see... I had that overrides the OnResize event for restrict the control's resize. If you comment the overrides OnResize event, the user can resize the control, yet return SelectionRules.Locked in the overrides SelectionRules property.
Thank You for any help.
CFQüeb
PS.
If my control is an instance of the Form class, the problem is the same.
CFQüeb - 11 Feb 2005 22:59 GMT
Sorry for my insistence in this issue. Nobody has found the reason for
which the Overrides does not works?