DrawingAttributes.Color - свойство
Обновлен: Ноябрь 2007
Gets or sets the color of the ink that is drawn with this DrawingAttributes object.
Пространство имен: Microsoft.Ink
Сборка: Microsoft.Ink (в Microsoft.Ink.dll)
Синтаксис
'Декларация
Public Property Color As Color
'Применение
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);
}
/** @property */
public Color get_Color()
/** @property */
public void set_Color(Color value)
public function get Color () : Color
public function set Color (value : Color)
Значение свойства
Тип: 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. |
Заметки
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.
Примеры
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
Платформы
Windows Vista
Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.
Сведения о версии
.NET Framework
Поддерживается в версии: 3.0
См. также
Ссылки
Microsoft.Ink - пространство имен
InkCollector.SupportHighContrastInk
InkOverlay.SupportHighContrastInk