共用方式為


Width Property

Width Property

Gets or sets the y-axis dimension, or width, of the pen tip when drawing ink.

Declaration

[C++]

[C++]
[propget] HRESULT get_Width([out, retval] float *CurrentWidth);
[propput] HRESULT put_Width([in] float NewWidth);

[Microsoft® Visual Basic® 6.0]

[Visual Basic]
Public Property Get Width() As Single
Public Property Let Width( _
    ByVal NewWidth As Single)

Property Value

float The y-axis dimension, or width, of the pen tip in HIMETRIC units when drawing ink.

The default pen width is 53 (in HIMETRIC units).

This property is read/write.

Return Value

HRESULT value Description
S_OK Success.
E_POINTER Parameter pointer is NULL or invalid.
E_INK_EXCEPTION An exception occurs inside the method.
E_INVALIDARG The width of the pen is less than 0.
E_UNEXPECTED Unexpected parameter or property type.

Remarks

If the tablet reports pen pressure, the actual width of the ink varies depending on the amount of pressure applied to the drawing surface. When maximum pressure is applied, the width is 3/2 times the Width property. When minimum pressure is applied, the width is 1/2 the Width value. By default, pressure from the pen is reported. To specify that pressure should not be reported (that the width of ink does not change), use the IgnorePressure property.

If the tablet reports pen pressure (if the IgnorePressure property is false), the actual width of the ink varies depending on the amount of pressure applied to the drawing surface. When maximum pressure is applied, the width is 150% of the value of the Width property. When minimum pressure is applied, the width is 50% of the value of the Width property. By default, pressure from the pen is reported. To specify that pressure should not be reported (that the width of ink does not change), set the IgnorePressure property to true.

Precision is limited to one one-thousandth of a HIMETRIC unit (three digits to the right of the decimal point). For example, if you specify a value of 2.0006, the most precise measurement is 2.001.

Example

[Visual Basic 6.0]

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

[Visual Basic]
Dim theInkCollector As InkCollector
'...
Private Sub MenuInkWidthThin_Click()
    MenuInkWidthThin.Checked = _
        Not MenuInkWidthThin.Checked
    MenuInkWidthThick.Checked = False
    theInkCollector.DefaultDrawingAttributes.Width = 10
End Sub
'...
Private Sub MenuInkWidthThick_Click()
    MenuInkWidthThick.Checked = _
        Not MenuInkWidthThick.Checked
    MenuInkWidthThin.Checked = False
    theInkCollector.DefaultDrawingAttributes.Width = 200
End Sub

Applies To