[VB.NET][ASP.NET] Designer CustomControl Panel


Sep 28, 2004
Programming Experience
[font=verdana, arial, helvetica]Hi,

I currently develop personalized controls I found while seeking on the Web, how to have the design of my component when I make it slip on a Web form In short so that a textBox resembles a textbox, a label with a label etc

For example

'''<summary>Classe de gestion des contrôles "TextBox" sécurisés</summary>
<DesignerAttribute(GetType(Design.TextBoxDesigner), GetType(IDesigner))> _
Public Class TextBox
Inherits System.Web.UI.WebControls.TextBox
Implements System.Web.UI.INamingContainer

property ...
sub ...
function ...

end class

Namespace Design

'''<summary>Classe de gestion de l'affichage en mode Design des contrôles TextBox sécurisés</summary>
Friend Class TextBoxDesigner
Inherits System.Web.UI.Design.ControlDesigner

'''<summary>Obtient le code HTML utilisé pour représenter le contrôle au moment du design.</summary>
Public Overrides Function GetDesignTimeHtml() As String

'Déclaration des variables ---
Dim sDesignTimeHTML As String
Dim oMondTextBox As Mond.Web.UI.WebControls.TextBox
Dim oTextBox As System.Web.UI.WebControls.TextBox
Dim oStringWriter As System.IO.StringWriter
Dim oHtmlTextWriter As System.Web.UI.HtmlTextWriter

'instance de la classe Mond.Web.UI.WebControls.TextBox associé à la classe TextBoxDesigner
oMondTextBox = CType(Component, Mond.Web.UI.WebControls.TextBox)

'on crée un control TextBox du type System.Web.UI.WebControls.TextBox
'on lui affecte la valeur de cette propiété Text
oTextBox = New System.Web.UI.WebControls.TextBox
oTextBox.Text = oMondTextBox.Text

'on extrait le contenu du contrôle serveur dans un objet HtmlTextWriter
oStringWriter = New System.IO.StringWriter
oHtmlTextWriter = New System.Web.UI.HtmlTextWriter(oStringWriter)


'on récupère le code HTML du TextBox pour représenter le contrôle au moment du design
sDesignTimeHTML = oStringWriter.ToString

'Retourne le résultat ---
Return sDesignTimeHTML

End Function

End Class

End Namespace

I would like to make the same thing for my control personalized Panel, but I seek to have more precise quelquechose

I am explained the control personalized Panel which I created contains a bar of title, with a title and a bond "Reduire"/"Développer" to reduce or develop the panel
In design mode, I would wish to reveal this bar of title.

I tried to add as for the panel, HTMLTable, with all that it is necessary inside, but no modification is taken into account.

Do you have an idea?