This documentation is archived and is not being maintained.

Color.FromName Method

Creates a Color structure from the specified name of a pre-defined color.

[Visual Basic]
Public Shared Function FromName( _
   ByVal name As String _
) As Color
[C#]
public static Color FromName(
 string name
);
[C++]
public: static Color FromName(
 String* name
);
[JScript]
public static function FromName(
   name : String
) : Color;

Parameters

name
A string that is the name of a pre-defined color. Valid names are the same as the names of the elements of the KnownColor enumeration.

Return Value

The Color structure that this method creates.

Remarks

A pre-defined color is also called a known color and is represented by an element of the KnownColor enumeration. If name is not the valid name of a pre-defined color, the FromName method creates a Color structure that has an ARGB value of zero (that is, all ARGB components are 0).

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Color Structure | Color Members | System.Drawing Namespace

Show: