Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Color.FromValues Method

Creates a Color structure with the specified color channel values, and color profile, and an alpha value of 1.

Namespace: System.Windows.Media
Assembly: PresentationCore (in presentationcore.dll)

public static Color FromValues (
	float[] values,
	Uri profileUri
)
public static Color FromValues (
	float[] values, 
	Uri profileUri
)
public static function FromValues (
	values : float[], 
	profileUri : Uri
) : Color
You cannot use methods in XAML.

Parameters

values

The collection of values used to specify the color channels of the Color structure. These values map to the profileUri.

profileUri

The International Color Consortium (ICC) or Image Color Management (ICM) color profile used for the Color structure.

Return Value

The Color structure created.

A International Color Consortium (ICC) or Image Color Management (ICM) color profile contains a color system profile for a particular application or device such as a color printer. This profile is matched to a common profile that in turn can be mapped to the individual profiles of other devices. This allows the color system used by one computer device to match the colors from other applications and devices on the same or other computer systems.

The following example shows how to use the FromValues method to create a Color structure.

private Color FromValuesExample()
{
    // Create a brown color using the FromValues static method.
    Color myValuesColor = new Color();
    float[] colorValues = new float[4];
    colorValues[0] = 0.0f;
    colorValues[1] = 0.5f;
    colorValues[2] = 0.5f;
    colorValues[3] = 0.5f;

    // Uri to sample color profile. This color profile is used to 
    // determine what the colors the colorValues map to.
    Uri myIccUri = new Uri("C:\\sampleColorProfile.icc");

    // The values given by the first parameter are used with the color 
    // profile specified by the second parameter to determine the color.
    myValuesColor = Color.FromValues(colorValues, myIccUri);
    return myValuesColor;
}

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions

Show:
© 2015 Microsoft