次の方法で共有


Color Property

Color Property

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

Declaration

[C++]

[propput] HRESULT put_Color ([in] long Color);
[propget] HRESULT get_Color ([out, retval] long* Color);

[Microsoft® Visual Basic® 6.0]

Public Property Get Color() As Long
Public Property Let Color(ByVal theColor As Long)

Property Value

long The color of the ink that is drawn with this InkDrawingAttributes object.

The default value is Black (RGB(0,0,0)).

This property is read/write.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER The Color parameter is an invalid pointer.
E_INK_EXCEPTION An exception occurred inside the method.
E_UNEXPECTED Unexpected parameter or property type.

Remarks

In High Contrast mode, ink always appears with the system color setting (COLOR_WINDOWTEXT), regardless of the setting of the Color property. However, the actual color of the ink is always saved as the set color, or default color (Black) 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.

To effectively enable High Contrast mode, you must set the ink collector's AutoRedraw property to TRUE (which means that 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.

Example

[Visual Basic 6.0]

This Visual Basic 6.0 example shows menu handlers that change the Color property of a InkDrawingAttributes object.

   Dim theInkCollector As InkCollector
'...
    Private Sub MenuInkColorBlue_Click()
        theInkCollector.DefaultDrawingAttributes.Color = vbBlue
    End Sub

    Private Sub MenuInkColorRed_Click()
        theInkCollector.DefaultDrawingAttributes.Color = vbRed
    End Sub

Applies To