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 对象关联的窗口接收到 Paint 通知时,是否自动重绘当前与 InkCollector 对象关联的 Ink 对象。例如,如果 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

另请参见

参考

InkCollector 类

InkCollector 成员

Microsoft.Ink 命名空间

InkCollector.DynamicRendering

Ink

Renderer.Draw