LEADTOOLS (Leadtools assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
FromKnownColor Method
See Also 
Leadtools Namespace > RasterColor Structure : FromKnownColor Method



knownColor
One of the RasterKnownColor enumeration members.
knownColor
One of the RasterKnownColor enumeration members.
Creates a new RasterColor structure from a known color. Supported in Silverlight, Windows Phone 7

Syntax

Visual Basic (Declaration) 
<CLSCompliantAttribute(False)>
Public Shared Function FromKnownColor( _
   ByVal knownColor As RasterKnownColor _
) As RasterColor
Visual Basic (Usage)Copy Code
Dim knownColor As RasterKnownColor
Dim value As RasterColor
 
value = RasterColor.FromKnownColor(knownColor)
C# 
[CLSCompliantAttribute(false)]
public static RasterColor FromKnownColor( 
   RasterKnownColor knownColor
)
C++/CLI 
[CLSCompliantAttribute(false)]
public:
static RasterColor FromKnownColor( 
   RasterKnownColor knownColor
) 

Parameters

knownColor
One of the RasterKnownColor enumeration members.

Return Value

The new RasterColor object.

Example

Visual BasicCopy Code
Public Sub FromKnownColorExample()
   ' Create a yellow color (R = 255, G = 255, B = 0)
   Dim clr1 As New RasterColor(255, 255, 0)

   ' Now create the same color using the "Yellow" known color
   Dim clr2 As RasterColor = RasterColor.FromKnownColor(RasterKnownColor.Yellow)

   ' Make sure both colors have the same value
   Debug.Assert(clr1.A = clr2.A)
   Debug.Assert(clr1.R = clr2.R)
   Debug.Assert(clr1.G = clr2.G)
   Debug.Assert(clr1.B = clr2.B)
End Sub
C#Copy Code
public void FromKnownColorExample()
{
   // Create a yellow color (R = 255, G = 255, B = 0)
   RasterColor clr1 = new RasterColor(255, 255, 0);

   // Now create the same color using the "Yellow" known color
   RasterColor clr2 = RasterColor.FromKnownColor(RasterKnownColor.Yellow);

   // Make sure both colors have the same value
   Debug.Assert(clr1.A == clr2.A);
   Debug.Assert(clr1.R == clr2.R);
   Debug.Assert(clr1.G == clr2.G);
   Debug.Assert(clr1.B == clr2.B);
}
SilverlightCSharpCopy Code
SilverlightVBCopy Code

Remarks

You can use the RasterKnownColor enumeration to construct RasterColor objects from colors known by name.

Requirements

Target Platforms: Silverlight, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7, MAC OS/X (Intel Only), Windows Phone 7

See Also