From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

CwGraph, Colors and .Net

I'm trying to modify the colors of my graph.
Some parameters use the system.color library
like
Dim myColor As Color
Graph.BackColor = myColor.Black

but others require a unsigned 32 bit integer
like
Graph.Plots.Item(1).LineColor = 'some value'

what's the syntax for setting line/fill colors in .Net?

Curt
0 Kudos
Message 1 of 2
(4,807 Views)
The unsigned 32-bit integer is a Win32 color, so you can use the System.Drawing.ColorTranslator class's ToWin32 method to convert a System.Drawing.Color to an integer. To convert the integer to an unsigned integer, use Convert.ToUInt32. Here's an example:

Dim lineColor As Integer = ColorTranslator.ToWin32(Color.Red)
Graph.Plots.Item(1).LineColor = Convert.ToUInt32(lineColor)

- Elton
Message 2 of 2
(4,807 Views)