LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert .NET color reference to LabVIEW color

Solved!
Go to solution

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,

0 Kudos
Message 1 of 9
(3,261 Views)

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.


___________________
Try to take over the world!
Message 2 of 9
(3,234 Views)
Solution
Accepted by topic author sangbui_palpro

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.

http://msdn.microsoft.com/en-us/library/system.drawing.color.toargb.aspx?cs-save-lang=1&cs-lang=cpp#...

Palpro

0 Kudos
Message 3 of 9
(3,210 Views)

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

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 9
(3,176 Views)

Hi Yamaeda,

 

I tried it.  It didn't work.

 

Palpro,

0 Kudos
Message 5 of 9
(3,161 Views)

NET-color.png

Works well. 🙂

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 6 of 9
(3,154 Views)

Yes, it worked.  Thanks.

0 Kudos
Message 7 of 9
(3,149 Views)

How do I convert the vice versa of this?  I have labview color control and want to get the respective .net color reference.

--
Ajay MV


0 Kudos
Message 8 of 9
(2,865 Views)

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.


___________________
Try to take over the world!
Message 9 of 9
(2,840 Views)