Hi,
I created a usercontrol that has a custom property "XColor" (color type), which I want to set to "Color.Yellow" (RGB 255,255,0) as default, both at designtime and runtime.
I googled around, to find out that I would have to need "System.ComponentModel.DefaultValue", however, this has some overloads that provide access to all standard datatypes (integer, byte, etc...), and even to an object type, but you can not access a color-type directly.
Am I forced to create some object, that holds the color, or is there a simpler way?
I used the following code to, bet that doesn't seem to have any effect for design-time placed usercontrol instances:
I haven't checked out is this works for runtime created instances too (but I suppose it will).
How do I set XColor to Color.Yellow?
I created a usercontrol that has a custom property "XColor" (color type), which I want to set to "Color.Yellow" (RGB 255,255,0) as default, both at designtime and runtime.
I googled around, to find out that I would have to need "System.ComponentModel.DefaultValue", however, this has some overloads that provide access to all standard datatypes (integer, byte, etc...), and even to an object type, but you can not access a color-type directly.
Am I forced to create some object, that holds the color, or is there a simpler way?
I used the following code to, bet that doesn't seem to have any effect for design-time placed usercontrol instances:
Code:
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
XColor = Color.Yellow
End Sub
How do I set XColor to Color.Yellow?