so right now I need to make a custom control for a c# project, The main point is I would like to make one control where i can change the text-color using the control properties via a drop-down. So I would like to limit what colors can be choosen. Right now, i have Four separate color labels,, but I need one with an option to change the color from a single property. The colors are predefined using RGB values. Here is the existing label code, how can I make it into one label with multiple color options?
That is the existing label code.
http://pastebin.com/mezTBMxN
Thank you for all help.
You can define your own custom property using a public enum containing the four colors you want. Then, when you render your control, you can set the ForeColor accordingly.
Enum:
Custom Property:
Set color in constructor or override RenderControl(). Note, you can use Color.FromArgb() if you like, however, I would recommend assigning CSS classes to keep your presentation separated.