InkDrawingAttributes.Color 屬性

定義

取得或設定值,這個值表示 InkStroke的色彩。

public:
 property Color Color { Color get(); void set(Color value); };
Color Color();

void Color(Color value);
public Color Color { get; set; }
var color = inkDrawingAttributes.color;
inkDrawingAttributes.color = color;
Public Property Color As Color

屬性值

筆跡色彩做為 ARGB 值。 預設值為黑色 (0、0、0、0) 。

範例

下列範例示範如何使用Windows.UI.ColorHelper.FromArgb方法,設定InkStroke (stroke) 的 Color 屬性 color () 。

var drawingAttributes = stroke.drawingAttributes;
drawingAttributes.color = 
     Windows.UI.ColorHelper.fromArgb(255, 255, 0, 0);
stroke.drawingAttributes = drawingAttributes;

下列替代方案示範如何在不使用Windows.UI.ColorHelper.FromArgb方法的情況下,設定InkStroke (stroke) 的 Color 屬性 (color) 。

var drawingAttributes = stroke.drawingAttributes;
var color = drawingAttributes.color;
color.a = 255;
color.r = 255;
color.g = 0;
color.b = 0;
drawingAttributes.color = color;
stroke.drawingAttributes = drawingAttributes;

備註

Color 的值是 ARGB 值。 不過,會忽略透明度元件 (A 或 Alpha 色板) 的值,並以完全不透明度呈現 InkStroke

透明度元件的值不會捨棄。 儲存 InkStroke 時,它會與 Ink 序列化格式 (ISF) 檔案中的其他所有筆劃資料一起儲存。

適用於

另請參閱