Best practices, code snippets for common functionality, examples, and guidelines.
-
BCTest
- Posts: 112
- Joined: Tue Jun 03, 2014 10:15 am
- Location: Hamburg, Germany
Post
by BCTest » Fri Oct 23, 2020 8:17 am
Hi,
looks like I made something seriously stupid but I don't know how to troubleshoot.
I want to use
Color.ControlDarkDark
(
https://docs.microsoft.com/de-de/dotnet ... work-4.7.2) in Ranorex but got a compiler error
Error CS0117: 'System.Drawing.Color' enthält keine Definition für 'ControlDarkDark'.
(
'System.Drawing.Color' does not contain a definition for 'ControlDarkDark'.)
How can I solve it?
BTW:
Color.Red
eg. works.
Thanks in advance,
bctest
-
BCTest
- Posts: 112
- Joined: Tue Jun 03, 2014 10:15 am
- Location: Hamburg, Germany
Post
by BCTest » Fri Oct 23, 2020 8:21 am
Just an addition:
Validate.AttributeEqual(repo.ReportItemInfo, "BackColor", "ControlDarkDark");
works fine.
Regards,
bcTest
-
odklizec
- Ranorex Guru

- Posts: 6360
- Joined: Mon Aug 13, 2012 9:54 am
- Location: Zilina, Slovakia
Post
by odklizec » Fri Oct 23, 2020 8:23 am
Hi,
Please post entire code, include applied "usings".
Pavel Kudrys
Ranorex explorer at
Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
-
BCTest
- Posts: 112
- Joined: Tue Jun 03, 2014 10:15 am
- Location: Hamburg, Germany
Post
by BCTest » Fri Oct 23, 2020 8:38 am
Here:
private void Init()
{
var colorRed = System.Drawing.Color.Red;
var colorDarkGray = System.Drawing.Color.DarkGray;
var colorSysGray = System.Drawing.Color.ControlDarkDark;
}

- color.png (81.66 KiB) Viewed 156 times
-
odklizec
- Ranorex Guru

- Posts: 6360
- Joined: Mon Aug 13, 2012 9:54 am
- Location: Zilina, Slovakia
Post
by odklizec » Fri Oct 23, 2020 9:23 am
Hi,
Apparently, ControlDarkDark cannot be used directly, as other colors? Maybe it's available in higher .NET version? But it's definitely not available in 4.7.2...

- ControlDarkDark.png (26.09 KiB) Viewed 154 times
But you can do it this way:
Code: Select all
var colorSysGray = System.Drawing.Color.FromName("ControlDarkDark");
You may find this link useful...
http://rnddev.blogspot.com/2011/03/any- ... s-net.html
Pavel Kudrys
Ranorex explorer at
Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
-
BCTest
- Posts: 112
- Joined: Tue Jun 03, 2014 10:15 am
- Location: Hamburg, Germany
Post
by BCTest » Fri Oct 23, 2020 1:03 pm
Hi odklizec,
yes, your hint was very useful,
thanks a lot.
Only to clarify: the link I posted before (
https://docs.microsoft.com/de-de/dotnet ... work-4.7.2) was from Microsoft for Framework 4.7.2. so this color should be definied ... at least that's what the documentation says.
Nevermind now it works for me.
Regards,
bcTest
-
odklizec
- Ranorex Guru

- Posts: 6360
- Joined: Mon Aug 13, 2012 9:54 am
- Location: Zilina, Slovakia
Post
by odklizec » Fri Oct 23, 2020 1:08 pm
Hi,
Yes, I saw in the doc, that it should work with 4.7.2, except it does not

Anyway, the workaround should be viable substitute.
Pavel Kudrys
Ranorex explorer at
Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration