Color.FromValues(Single[], Uri) 方法

定義

使用指定的色頻值和色彩設定檔建立新的 Color 結構。

public:
 static System::Windows::Media::Color FromValues(cli::array <float> ^ values, Uri ^ profileUri);
public static System.Windows.Media.Color FromValues (float[] values, Uri profileUri);
static member FromValues : single[] * Uri -> System.Windows.Media.Color
Public Shared Function FromValues (values As Single(), profileUri As Uri) As Color

參數

values
Single[]

值的集合,指定新色彩的色頻。 這些值會對應至 profileUri

profileUri
Uri

國際色彩聯盟 () 或影像色彩管理 (ICM) 新色彩的色彩設定檔。

傳回

Color

Color 結構,具有指定的值和 Alpha 色頻值 1。

範例

下列範例示範如何使用 FromValues 方法來建立 Color 結構。

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;
}
Private Function FromValuesExample() As Color
    ' Create a brown color using the FromValues static method.
    Dim myValuesColor As New Color()
    Dim colorValues(3) As Single
    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.
    Dim myIccUri As 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
End Function

備註

國際色彩聯盟 (ICC) 或影像色彩管理 (ICM) 色彩設定檔包含特定應用程式或裝置的色彩系統設定檔,例如色彩印表機。 此設定檔會與一般設定檔相符,而該設定檔接著可以對應至其他裝置的個別設定檔。 這可讓一部電腦裝置使用的色彩系統符合相同或其他電腦系統上其他應用程式和裝置的色彩。

適用於