Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to assign color to a legenditem?

I have a GUI where I have a legend and some leds.

I need to assign various colors to the legend items according to led color status.For example one legend item has to be orange and say text. I find no way to assign color orange to the led item.
How do i do this?

0 Kudos
Message 1 of 3
(3,769 Views)
Hi jobin007007,
 
To achieve this, you would use the Source property in the LegendItem class.
 
However, the Source property expects an object that implements the ILegendItemSource interface. Unfortunately, the Led Class does not implement this interface; only a select few implement the ILegendItemSource interface, such as the DigitalPlot and XYPlot objects. Essentially jobin007007, you will have to create your own Led Class that implements the ILegendItemSource inteface.
 
For further detail of the members that an object must implement for the ILegendItemSource interface, please read the help for ILegendItemSource Members under the NI Measurement Studio .NET Class Library help. I however would suggest simply creating a Label and PictureBox pair for your LED, and updating the pair when the LED changes color.
 
If you are not familiar with Interfaces, I would suggest viewing the link below:
http://www.csharp-station.com/Tutorials/Lesson13.aspx
Nestor
0 Kudos
Message 2 of 3
(3,746 Views)

Thanks,

I tried that and it works.

I just build three empty x-y plots with the background color i want in my legend items. I chose to hide the x-y plots. Then i was able to assin my three legend item source property to the x-y plot.

Thank you for the help

0 Kudos
Message 3 of 3
(3,739 Views)