NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
Curt_C
Posts: 198
0 Kudos

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
Active Participant
Elton Wells
Posts: 857

Re: CwGraph, Colors and .Net

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
By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page