DrawingAttributes.Color Property

Gets or sets the color of the ink that is drawn with this DrawingAttributes object.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public Property Color As Color
'Usage
Dim instance As DrawingAttributes 
Dim value As Color 

value = instance.Color

instance.Color = value
public Color Color { get; set; }
public:
property Color Color {
    Color get ();
    void set (Color value);
}
public function get Color () : Color 
public function set Color (value : Color)

Property Value

Type: System.Drawing.Color
The color of the ink that is drawn with this DrawingAttributes object.

Value

Meaning

Black

Ink is rendered in Black.

System.Drawing.Color

The ink is rendered in the color of the selected Color object.

Remarks

In High Contrast mode, ink always appears with the system color setting (WindowText), regardless of the setting of the Color property. However, the actual color of the ink is always saved as the color set in the Color property (or the default color if not set). For example, if the Color property is set to (Red), a user in High Contrast mode sees the ink in the system color, but a user not in High Contrast mode sees the ink drawn as the set color Red. This functionality allows a user in High Contrast mode to view the ink in the system setting without modifying the actual stroke color.

This means that by default all ink is mapped to one color when in High Contrast mode. To disable this default color-mapping behavior and implement your own, use the ink collector's SupportHighContrastInk property (InkCollector.SupportHighContrastInk, InkOverlay.SupportHighContrastInk, or InkPicture.SupportHighContrastInk).

To effectively enable High Contrast mode, you must set the ink collector's AutoRedraw property (InkCollector.AutoRedraw, InkOverlay.AutoRedraw, or InkPicture.AutoRedraw) to true. If you set the AutoRedraw property to true, ink is redrawn when the window is invalidated. The Tablet PC application programming interface (API) does not support High Contrast mode if you set the AutoRedraw property to false.

Examples

This C# example contains menu handlers that change the Color property of a DrawingAttributes object.

using Microsoft.Ink;
using System.Drawing;
//...
    private System.Windows.Forms.MenuItem menuInkColorRed;
    private System.Windows.Forms.MenuItem menuInkColorBlue;
    private InkCollector theInkCollector;
    private System.Windows.Forms.MenuItem checkedColor;

//...
    private void menuInkColorRed_Click(
    object sender, System.EventArgs e)
    {
        checkedColor.Checked = false;
        theInkCollector.DefaultDrawingAttributes.Color = Color.Red;
        checkedColor = menuInkColorRed;
        checkedColor.Checked = true;
        Refresh();
    }

    private void menuInkColorBlue_Click(
    object sender, System.EventArgs e)
    {
        checkedColor.Checked = false;
        theInkCollector.DefaultDrawingAttributes.Color = Color.Blue;
        checkedColor = menuInkColorBlue;
        checkedColor.Checked = true;
        Refresh();
    }

This Microsoft® Visual Basic® .NET example contains menu handlers that change the Color property of a DrawingAttributes object.

Imports Microsoft.Ink
Imports System.Drawing
'...
    Dim MenuInkColorRed As System.Windows.Forms.MenuItem
    Dim MenuInkColorBlue As System.Windows.Forms.MenuItem
    Dim CheckedColor As System.Windows.Forms.MenuItem
    Dim theInkCollector As InkCollector
'...
    Private Sub MenuInkColorRed_Click( _
    ByVal sender As Object, ByVal e As System.EventArgs)
        CheckedColor.Checked = False
        theInkCollector.DefaultDrawingAttributes.Color = Color.Red
        CheckedColor = MenuInkColorRed
        CheckedColor.Checked = True
        Refresh()
    End Sub

    Private Sub MenuInkColorBlue_Click( _
    ByVal sender As Object, ByVal e As System.EventArgs)
        CheckedColor.Checked = False
        theInkCollector.DefaultDrawingAttributes.Color = Color.Blue
        CheckedColor = MenuInkColorBlue
        CheckedColor.Checked = True
        Refresh()
    End Sub

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

DrawingAttributes Class

DrawingAttributes Members

Microsoft.Ink Namespace

InkCollector.AutoRedraw

InkOverlay.AutoRedraw

InkPicture.AutoRedraw

InkCollector.SupportHighContrastInk

InkOverlay.SupportHighContrastInk

InkPicture.SupportHighContrastInk

Renderer.Draw