DrawingAttributes.Width プロパティ
インクを描画するときの y 軸の次元またはペン先の幅を取得または設定します。
名前空間 : 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
インクを描画するときの y 軸の次元またはペン先の幅。
値 |
説明 |
---|---|
53 |
ペン先の幅は、53 HIMETRIC 単位です。 |
Single |
ペン先の幅を表す値 (HIMETRIC 単位)。 |
解説
Width プロパティは HIMETRIC 単位です。
タブレットがペンの圧力を報告する場合 (IgnorePressure プロパティが false の場合)、インクの実際の幅は、描画サーフェスに適用される圧力の強さによって異なります。最大圧力が適用されると、幅は Width プロパティの値の 150% になります。最小圧力が適用されると、幅は Width プロパティの値の 50% になります。既定では、ペンの圧力が報告されます。圧力を報告しない (インクの幅を変更しない) ように指定するには、IgnorePressure プロパティを true に設定します。
精度は、HIMETRIC 単位の 1/1000 (小数点の右 3 桁) に制限されます。たとえば、値 2.0006 を指定した場合、最も正確な測定値は 2.001 になります。
例
この C# の例では、DrawingAttributes オブジェクトの Width プロパティを変更するメニュー項目のイベント ハンドラを作成します。
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();
}
この Microsoft® Visual Basic® .NET の例では、DrawingAttributes オブジェクトの Width プロパティを変更するメニュー項目のイベント ハンドラを作成します。
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