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

定義

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

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

參數

a
Single

新色彩的 Alpha 色板,這是介於 0 到 1 之間的值。

values
Single[]

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

profileUri
Uri

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

傳回

具有指定之值的 Color 結構。

範例

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

private Color FromAValuesExample()
{
    // Create a brown color using the FromAValues static method.
    Color myAValuesColor = 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 iccUri = new Uri("C:\\sampleColorProfile.icc");

    // The FromAValues method requires an explicit value for alpha
    // (first parameter). The values given by the second parameter are
    // used with the color profile specified by the third parameter to 
    // determine the color.
    myAValuesColor = Color.FromAValues(1.0f, colorValues, iccUri);
    return myAValuesColor;
}
Private Function FromAValuesExample() As Color
    ' Create a brown color using the FromAValues static method.
    Dim myAValuesColor 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 iccUri As New Uri("C:\sampleColorProfile.icc")

    ' The FromAValues method requires an explicit value for alpha
    ' (first parameter). The values given by the second parameter are
    ' used with the color profile specified by the third parameter to 
    ' determine the color.
    myAValuesColor = Color.FromAValues(1.0f, colorValues, iccUri)
    Return myAValuesColor
End Function

備註

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

適用於