Forum Discussion

mauricekoster's avatar
Occasional Contributor
8 years ago

How to convert retrieved property 'BackColor' to System.Drawing.Color?



How do I convert retrieved BackColor property to System.Drawing.Color?


This is the code I use to get the BackColor:


object backColorValue = textEdit.GetProperty<object>("BackColor");


But how do I convert it to type System.Drawing.Color? According to TestLeft Spy this is the class name of this property (ClrFullClassName)


Simple casting does not seem to work:

Color c = (Color) backColorValue;



Additional information: Specified cast is not valid.



No RepliesBe the first to reply