ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

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
(5,784 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
(5,784 Views)