InkCollector.AutoRedraw 屬性
取得或設定值,這個值指定 InkCollector 物件是否會在視窗失效時重繪筆墨。
命名空間: Microsoft.Ink
組件: Microsoft.Ink (在 Microsoft.Ink.dll 中)
語法
'宣告
Public Property AutoRedraw As Boolean
'用途
Dim instance As InkCollector
Dim value As Boolean
value = instance.AutoRedraw
instance.AutoRedraw = value
public bool AutoRedraw { get; set; }
public:
property bool AutoRedraw {
bool get ();
void set (bool value);
}
/** @property */
public boolean get_AutoRedraw()
/** @property */
public void set_AutoRedraw(boolean value)
public function get AutoRedraw () : boolean
public function set AutoRedraw (value : boolean)
屬性值
型別:System.Boolean
如果 InkCollector 物件會在視窗失效時重繪筆墨,則為 true,否則為 false。
備註
AutoRedraw 的值會指定目前與 InkCollector 物件關聯的 Ink 物件是否會在與 InkCollector 物件關聯的視窗收到 Paint 通知時自動重繪。例如,如果 AutoRedraw 設定為 true,則在將視窗最小化再加以還原時,筆墨就會自動重繪。如果設定為 false,則在將視窗最小化再加以還原時,筆墨就會從檢視中消失。
當 AutoRedraw 為 false 時,除非 DynamicRendering 屬性為 false,否則在筆墨書寫時筆墨還是會出現。
當應用程式執行自訂呈現或應用程式易受繪製問題影響時,您可以自行處理重繪並將 InkPicture 控制項的 AutoRedraw 屬性設定為 false。在這種情況下,您可以將委派加入至基礎控制項的 OnPaint 事件處理常式來自行繪製筆墨,或是處理基礎控制項的 Invalidate 事件來修改 InvalidateEventArgs 物件。
範例
這個範例會將 AutoRedraw 屬性設定為 false,然後手動繪製筆墨,藉以在 InkCollector 物件中顯示筆劃。針對附加 InkCollector 的控制項,Paint 事件處理常式會檢查每個筆劃的大小。如果筆劃小於 400 筆墨空間單位,筆劃會顯示為藍色。
Private Sub mInkObjectControl_Paint(ByVal sender As Object, ByVal e As PaintEventArgs)
' Check if AutoRedraw is off
' mInkObject can be InkCollector, InkOverlay, or InkPicture
If Not mInkObject.AutoRedraw Then
' Draw each stroke manually
For Each stroke As Stroke In mInkObject.Ink.Strokes
' See if this stroke is small
Dim strokeBounds As Rectangle = stroke.GetBoundingBox()
If strokeBounds.Width < 400 And strokeBounds.Height < 400 Then
' Change the drawing color to blue
Dim newAttributes As DrawingAttributes = stroke.DrawingAttributes.Clone()
newAttributes.Color = Color.Blue
' Draw with these special drawing attributes
mInkObject.Renderer.Draw(e.Graphics, stroke, newAttributes)
Else
' Draw stroke with its own drawing attributes
mInkObject.Renderer.Draw(e.Graphics, stroke)
End If
Next
End If
End Sub
private void mInkObjectControl_Paint(object sender, PaintEventArgs e)
{
// Check if AutoRedraw is off
// mInkObject can be InkCollector, InkOverlay, or InkPicture
if (!mInkObject.AutoRedraw)
{
// Draw each stroke manually
foreach (Stroke stroke in mInkObject.Ink.Strokes)
{
// See if this stroke is small
Rectangle strokeBounds = stroke.GetBoundingBox();
if (strokeBounds.Width < 400 && strokeBounds.Height < 400)
{
// Change the drawing color to blue
DrawingAttributes newAttributes = stroke.DrawingAttributes.Clone();
newAttributes.Color = Color.Blue;
// Draw with these special drawing attributes
mInkObject.Renderer.Draw(e.Graphics, stroke, newAttributes);
}
else
{
// Draw stroke with its own drawing attributes
mInkObject.Renderer.Draw(e.Graphics, stroke);
}
}
}
}
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0