Custom Controls Creation (property)

A

Alex Nitulescu

Hi. I'm creating my first custom controls. I have this code:

Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)

output.AddAttribute("color", [Color])
output.RenderBeginTag("font")
output.RenderBeginTag("b")
output.Write(Reverse([Text]))
output.RenderEndTag()
output.RenderEndTag()
End Sub

<Description("Color of the text"), Bindable(True), Category("Appearance"),
DefaultValue("Black")> Property [Color]() As String

Get
Return _color
End Get

Set(ByVal Value As String)
_color = Value
End Set
End Property

where color is defined as string, as you can see. Therefore, in the
Properties of my UserControl, of course, "Color" expects a string. How can I
make my "color" property, in this example, to show the same as ForeColor,
for instance (with the color-picker already there). I know how to create
enumerations, I need the color-picker !

Also, please, is there a way to teach the IDE to list the properties of my
custom control, the same way it opens the listbox with the properties
(width, text, etc) and methods of, say, a built-in textbox ??? Currently, if
I add a property name, for instance "MyOriginalProperty" to a control, the
user who writes html would need to know that there is such a property,
"MyOriginalProperty"...

Thank you very much !
Alex
 
G

Guest

Hi Alex
Public Property color() As String
Get
Return textbox1.Style("ForColor")
End Get
Set(ByVal Value As String)
textbox1.Style("forcolor") = Value
End Set
End Property
'''''''''''''''''''''''''
hope this help
'''''''''''''''''''''''''''''
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top