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
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