Condividi tramite


Metodo Ink.AddStrokesAtRectangle

Aggiornamento: novembre 2007

Specifica l'insieme Strokes noto da inserire in questo oggetto Ink in un rettangolo specificato.

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

Sintassi

'Dichiarazione
Public Sub AddStrokesAtRectangle ( _
    strokes As Strokes, _
    destinationRectangle As Rectangle _
)
'Utilizzo
Dim instance As Ink
Dim strokes As Strokes
Dim destinationRectangle As Rectangle

instance.AddStrokesAtRectangle(strokes, _
    destinationRectangle)
public void AddStrokesAtRectangle(
    Strokes strokes,
    Rectangle destinationRectangle
)
public:
void AddStrokesAtRectangle(
    Strokes^ strokes, 
    Rectangle destinationRectangle
)
public void AddStrokesAtRectangle(
    Strokes strokes,
    Rectangle destinationRectangle
)
public function AddStrokesAtRectangle(
    strokes : Strokes, 
    destinationRectangle : Rectangle
)

Parametri

  • destinationRectangle
    Tipo: System.Drawing.Rectangle
    Rettangolo dove vengano aggiunti i tratti, nelle coordinate dello spazio di input penna.

Note

Un errore di runtime è generato se le coordinate del rettangolo sono {0,0,0,0}.

L'insieme Strokes di origine viene aggiunto all'oggetto Ink.

In caso di inserimento, i tratti vengono ridimensionati dal riquadro dell'insieme Strokes nel rettangolo.

Questo metodo può essere utilizzato per copiare i tratti all'interno di un solo oggetto Ink. I tratti di origine non devono venire da un altro oggetto Ink.

Esempi

In questo esempio di C# viene utilizzato il metodo AddStrokesAtRectangle per eseguire una copia dell'input penna da un oggetto InkCollector principale, panelMain, in un oggetto InkCollectorpanelThumb, mantenendo la scala e le proporzioni appropriate. Per tenere il pannello della miniatura corrente, un gestore eventi Stroke, panelMain_Stroke, viene aggiunto a panelMain.

private void panelMain_Stroke(object sender, Microsoft.Ink.InkCollectorStrokeEventArgs e)
{
    // Create a bounding rectangle for panelThumb in ink space coordinates
    Point thePoint = Point.Empty;
    using (Graphics g = Graphics.FromHwnd(Handle))
    {
        thePoint = new Point(panelThumb.Width, panelThumb.Height);
        panelMain.Renderer.PixelToInkSpace(g, ref thePoint);
    }
    Rectangle theRectangle = new Rectangle(0, 0, thePoint.X, thePoint.Y);   

    // Delete the old strokes in the thumbnail, and add the new strokes.
    panelThumb.Ink.DeleteStrokes();
    // The strokes are automatically scaled to the destination rectangle
    panelThumb.Ink.AddStrokesAtRectangle(panelMain.Ink.Strokes, theRectangle);
    Refresh();
}

In questo esempio di Microsoft Visual Basic.NET viene utilizzato il metodo AddStrokesAtRectangle per eseguire una copia dell'input penna da un oggetto InkCollector principale, panelMain, in un oggetto InkCollector, panelThumb, mantenendo la scala e le proporzioni appropriate. Per tenere il pannello della miniatura corrente, un gestore eventi Stroke, panelMain_Stroke, viene aggiunto a panelMain.

 Private Sub panelMain_Stroke(ByVal sender As System.Object, _
    ByVal e As Microsoft.Ink.InkCollectorStrokeEventArgs) Handles panelMain.Stroke

    'Create a bounding rectangle for panelThumb in ink space coordinates
    Dim g As Graphics = Graphics.FromHwnd(Handle)
    Dim thePoint As Point = New Point(panelThumb.Width, panelThumb.Height)
    panelMain.Renderer.PixelToInkSpace(g, thePoint)
    'Dispose of the Graphics object
    g.Dispose()
    Dim theRectangle As Rectangle = New Rectangle(0, 0, thePoint.X, thePoint.Y)

    'Delete the old strokes in the thumbnail, and add the new strokes.
    panelThumb.Ink.DeleteStrokes()
    'The strokes are automatically scaled to the destination rectangle
    panelThumb.Ink.AddStrokesAtRectangle(panelMain.Ink.Strokes, theRectangle)
    Refresh()
End Sub

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

Ink Classe

Membri Ink

Spazio dei nomi Microsoft.Ink

Strokes