Поделиться через


DrawingAttributes.Width - свойство

Обновлен: Ноябрь 2007

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

Пространство имен:  Microsoft.Ink
Сборка:  Microsoft.Ink (в Microsoft.Ink.dll)

Синтаксис

'Декларация
Public Property Width As Single
'Применение
Dim instance As DrawingAttributes
Dim value As Single

value = instance.Width

instance.Width = value
public float Width { get; set; }
public:
property float Width {
    float get ();
    void set (float value);
}
/** @property */
public float get_Width()
/** @property */
public  void set_Width(float value)
public function get Width () : float
public function set Width (value : float)

Значение свойства

Тип: System.Single
The y-axis dimension, or width, of the pen tip when drawing ink.

Value

Meaning

53

The width of the pen tip is 53 HIMETRIC units.

Single

Value representing the width of the pen tip, in HIMETRIC units.

Заметки

The Width property is in HIMETRIC units.

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.

Примеры

This C# example creates event handlers for menu items that change the Width property of a DrawingAttributes object.

using Microsoft.Ink;
//...
    private System.Windows.Forms.MenuItem menuInkWidthThin;
    private System.Windows.Forms.MenuItem menuInkWidthThick;
    private InkCollector theInkCollector;
    private System.Windows.Forms.MenuItem checkedWidth;

//...
    private void menuInkWidthThin_Click(
    object sender, System.EventArgs e)
    {
        checkedWidth.Checked = false;
        // Set the width about one pixel wide in HIMETRIC
        theInkCollector.DefaultDrawingAttributes.Width = 30;
        checkedWidth = menuInkWidthThin;
        checkedWidth.Checked = true;
        Refresh();
    }

    private void menuInkWidthThick_Click(
    object sender, System.EventArgs e)
    {
        checkedWidth.Checked = false;
        // Set the width about ten pixels wide in HIMETRIC
        theInkCollector.DefaultDrawingAttributes.Width = 300;
        checkedWidth = menuInkWidthThick;
        checkedWidth.Checked = true;
        Refresh();
    }

This Microsoft® Visual Basic® .NET example creates event handlers for menu items that change the Width property of a DrawingAttributes object.

Imports Microsoft.Ink
'...
    Dim MenuInkWidthThin As System.Windows.Forms.MenuItem
    Dim MenuInkWidthThick As System.Windows.Forms.MenuItem
    Dim CheckedWidth As System.Windows.Forms.MenuItem
    Dim theInkCollector As InkCollector
'...
    Private Sub MenuInkWidthThin_Click( _
    ByVal sender As Object, ByVal e As System.EventArgs)
        CheckedWidth.Checked = False
        'Set the width about one pixel wide in HIMETRIC
        theInkCollector.DefaultDrawingAttributes.Width = 30
        CheckedWidth = MenuInkWidthThin
        CheckedWidth.Checked = True
        Refresh()
    End Sub

    Private Sub MenuInkWidthThick_Click( _
    ByVal sender As Object, ByVal e As System.EventArgs)
        CheckedWidth.Checked = False
        theInkCollector.DefaultDrawingAttributes.Width = 300
        CheckedWidth = MenuInkWidthThick
        CheckedWidth.Checked = True
        Refresh()
    End Sub

Платформы

Windows Vista

Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.

Сведения о версии

.NET Framework

Поддерживается в версии: 3.0

См. также

Ссылки

DrawingAttributes Класс

DrawingAttributes - члены

Microsoft.Ink - пространство имен

DrawingAttributes.PenTip

DrawingAttributes.Height

DrawingAttributes.IgnorePressure