Condividi tramite


Proprietà InkCollector.AutoRedraw

Aggiornamento: novembre 2007

Ottiene o imposta un valore che specifica se l'oggetto InkCollector ridisegna l'input penna quando la finestra viene invalidata.

Spazio dei nomi:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Sintassi

'Dichiarazione
Public Property AutoRedraw As Boolean
'Utilizzo
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)

Valore proprietà

Tipo: System.Boolean
true se l'oggetto InkCollector ridisegna l'input penna quando la finestra viene invalidata; in caso contrario, false.

Note

Il valore di AutoRedraw specifica se l'oggetto Ink associato attualmente all'oggetto InkCollector verrà ridisegnato automaticamente o meno quando la finestra associata all'oggetto InkCollector riceve una notifica Paint. Ad esempio, se AutoRedraw è impostato su true, l'input penna viene automaticamente ridisegnato quando si riduce e quindi si ripristina la finestra. Se è impostato su false, quando si riduce e quindi si ripristina la finestra, l'input penna viene rimosso dalla visualizzazione.

Quando la proprietà AutoRedraw risulta false, l'input penna viene visualizzato durante l'immissione a meno che la proprietà DynamicRendering non sia impostata su false.

Se l'applicazione esegue rendering personalizzato oppure è condizionata dai problemi di disegno, è possibile gestire personalmente il nuovo disegno e impostare la proprietà AutoRedraw su false per il controllo InkPicture. In questo caso aggiungere un delegato al gestore eventi del controllo OnPaint sottostante per disegnare personalmente l'input penna oppure gestire l'evento del controllo Invalidate sottostante per modificare l'oggetto InvalidateEventArgs.

Esempi

In questo esempio vengono visualizzati i tratti di un oggetto InkCollector impostando la proprietà AutoRedraw su false e disegnando quindi manualmente l'input penna. Il gestore eventi Paint del controllo a cui è associato l'oggetto InkCollector verifica la dimensione di ogni tratto. Se il tratto è inferiore alle 400 unità dello spazio di input penna, viene visualizzato in blu.

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

}

Piattaforme

Windows Vista

.NET Framework e .NET Compact Framework non supportano tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.

Informazioni sulla versione

.NET Framework

Supportato in: 3.0

Vedere anche

Riferimenti

InkCollector Classe

Membri InkCollector

Spazio dei nomi Microsoft.Ink

InkCollector.DynamicRendering

Ink

Renderer.Draw