.netCHARTING v5.2 Documentation Send comments on this topic.
Using Colors
See Also
Getting Started > The Basics > Using Colors

Glossary Item Box

A color can be set simply with Color.Name e.g. Color.Red or Color.Blue.
Complete list of color names.


More advanced color creation using RGB, alpha and web color settings



Creates a Color structure from the specified 8-bit color values (red, green, and blue). The alpha value is implicitly 255 (no transparency).

[C#] Color myColor = Color.FromArgb(0, 255,125);
[Visual Basic]
Dim myColor As Color = Color.FromArgb(0, 255,125)

Creates a Color structure from the four ARGB component (alpha, red, green, and blue). Alpha is also known as transparency where 255 is totally solid and 0 is totally transparent.

[C#]
Color myColor = FromArgb(120, 0, 255,125);
[Visual Basic]
Dim myColor As Color = FromArgb(120, 0, 255,125)


Creates a Color from a 32-bit ARGB value. (alpha, red, green, and blue)

[C#]
Color myColor = Color.FromArgb(0x78FF0000);
[Visual Basic]
Dim myColor As Color = Color.FromArgb(&H78FF0000)

Creates a Color from the specified Color Name, but with the new specified alpha value, valid alpha values are between 0 through 255.

[C#]
Color myColor = Color.FromArgb(125,Color.Red);
[Visual Basic]
Dim myColor As Color = Color.FromArgb(125,Color.Red)

For converting a web color:
If the color is "bgcolor="#388B7E" , replace # with 0x(for csharp) or &H (for visual basic), and add an alpha value between 0-7F after that, then add the rest. (0x7F388B7E or &H7F388B7E)

[C#]
Color myColor = Color.FromArgb(0x7F388B7E);
[Visual Basic]
Dim myColor As Color = Color.FromArgb(&H7F388B7E)

 

Tip: When specifying a color for a box such as a legend or title box, it is useful to use just a slight hint of the specific color. This can be achieve by using code such as Color.FromArgb(15,Color.Green). This will result in a green shade that is virtually transparent.

For advanced information visit: .NET framework Color structure.

See Also

©2008. All Rights Reserved.