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


InkPicture.AutoRedraw - свойство

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

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

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

Синтаксис

'Декларация
<BrowsableAttribute(True)> _
Public Property AutoRedraw As Boolean
'Применение
Dim instance As InkPicture
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);
}
/** @property */
/** @attribute BrowsableAttribute(true) */
public boolean get_AutoRedraw()
/** @property */
/** @attribute BrowsableAttribute(true) */
public  void set_AutoRedraw(boolean value)
public function get AutoRedraw () : boolean
public function set AutoRedraw (value : boolean)

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

Тип: System.Boolean
Value that specifies whether the InkPicture control repaints the ink when the window is invalidated.

Value

Meaning

true

The InkPicture control repaints the ink when the window is invalidated.

false

The InkPicture control does not repaint the ink when the window is invalidated.

Заметки

The value for AutoRedraw specifies whether or not the Ink object currently associated with InkPicture control is automatically redrawn when the window associated with the InkPicture control 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 InkPicture control. In that case add a delegate to the InkPicture control's OnPainted event handler to draw the ink yourself or handle the inherited Invalidate event to modify the InvalidateEventArgs object.

Примеры

This example displays strokes in an InkPicture control by setting the AutoRedraw property to false, then manually drawing the ink. The Paint event handler for the InkPicture control 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);
            }
        }
    }

}

Платформы

Windows Vista

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

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

.NET Framework

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

См. также

Ссылки

InkPicture Класс

InkPicture - члены

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

InkPicture.OnPainted

InkPicture.DynamicRendering

Другие ресурсы

System.Windows.Forms.Control.Invalidate Method