Share via


InkOverlay.AutoRedraw Property

Gets or sets a value that specifies whether the InkOverlay object repaints the ink when the window is invalidated.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
<BrowsableAttribute(True)> _
Public Property AutoRedraw As Boolean
'Usage
Dim instance As InkOverlay 
Dim value As Boolean 

value = instance.AutoRedraw

instance.AutoRedraw = value
[BrowsableAttribute(true)]
public bool AutoRedraw { get; set; }
[BrowsableAttribute(true)]
public:
property bool AutoRedraw {
    bool get ();
    void set (bool value);
}
public function get AutoRedraw () : boolean 
public function set AutoRedraw (value : boolean)

Property Value

Type: System.Boolean
Value that specifies whether the InkOverlay object repaints the ink when the window is invalidated.
true if the InkOverlay object repaints the ink when the window is invalidated; otherwise, false.

Remarks

The value for AutoRedraw specifies whether or not the Ink object currently associated with InkOverlay object is automatically redrawn when the window associated with the InkOverlay object receives a Paint notification. For example, if set to true, when you minimize the window and then restore it, the ink is automatically redrawn. If set to false, when you minimize the window and then restore it, the ink disappears from view.

When AutoRedraw is false, the ink appears while inking unless the DynamicRendering property is false.

When your application is performing custom rendering or when your application is sensitive to painting issues, you can handle the repainting yourself and set the AutoRedraw property to false for the InkOverlay object. In that case add a delegate to the InkOverlay object's OnPainted event handler to draw the ink yourself or handle the underlying control's Invalidate event to modify the InvalidateEventArgs object.

Examples

This example displays strokes in an InkOverlay object by setting the AutoRedraw property to false, then manually drawing the ink. The Paint event handler for the control to which the InkCollector is attached checks the size of each stroke. If the stroke is smaller than 400 ink space units, the stroke appears blue.

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);
            }
        }
    }

}

Platforms

Windows 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

InkOverlay Class

InkOverlay Members

Microsoft.Ink Namespace

InkOverlay.DynamicRendering

InkOverlay.OnPainted