06-11-2013 08:21 PM
Hi all,
I am trying to convert a .NET FontDialog/Color reference to a LabVIEW color. I'd like to somehow get the RGB values from the reference then use the "RGB to Color.vi" but can't find an appropriate Property/Method from the reference. Please help.
Thank you,
Solved! Go to Solution.
06-12-2013 02:20 AM
You can call the To ARGB method to get the RGB value. It looks like an I32, so you might need some byte reshuffling to get it to the correct LV format. Split Number and Join Number should help.
If that doesn't help, post some actual code of what you've done and what you expect.
06-12-2013 12:41 PM
Hi tst,
Thanks for your help. I got it to work by using the ToArgb method. I attached a picture of the code. The following link from Microsoft is also helpful.
Palpro
06-13-2013 06:43 AM
The ToARGB should be the same form a LV-color, so the byte splitting shouldn't be necessary. Try it, just connect the ToARGB directly to the color box. 🙂
The 1st byte includes the Alpha value which should be ignored by LV, if it isn't you can mask that information away by 0x00FFFFFF AND color.
/Y
06-13-2013 11:47 AM
Hi Yamaeda,
I tried it. It didn't work.
Palpro,
06-13-2013 12:29 PM
Works well. 🙂
/Y
06-13-2013 01:06 PM
Yes, it worked. Thanks.
11-15-2015 09:05 PM
11-16-2015 01:34 AM
Generally, these things are not hiding and make some sense. The Color class has a ToArgb method, so it shouldn't surprise you to learn that it also has a FromArgb method, which presumably does the opposite.