InkCanvas.Paste Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Pastes the contents of the Clipboard to the InkCanvas.

Overloads

Paste()

Pastes the contents of the Clipboard to the top-left corner of the InkCanvas.

Paste(Point)

Pastes the contents of the Clipboard to the InkCanvas at a given point.

Remarks

The InkCanvas can support Clipboard data in Extensible Application Markup Language (XAML) format, Ink Serialized Format (ISF), and text format.

Paste()

Pastes the contents of the Clipboard to the top-left corner of the InkCanvas.

public void Paste ();

Examples

The following example copies an element to the Clipboard and pastes it to the InkCanvas. This example assumes that there is an element called rect1, and that the Click events have been connected to the event handlers in the example.

void copyXamlButton_Click(object sender, RoutedEventArgs e)
{
    string rectString = XamlWriter.Save(rect1);

    DataObject rectangleData = new DataObject(DataFormats.Xaml, rectString);
    Clipboard.SetDataObject(rectangleData);
}

void pasteButton_Click(object sender, RoutedEventArgs e)
{
    if (inkCanvas1.CanPaste())
    {
        inkCanvas1.Paste(new Point(100, 100));
    }
}

Remarks

The InkCanvas can support Clipboard data in Extensible Application Markup Language (XAML) format, Ink Serialized Format (ISF), and text format.

See also

Applies to

.NET Framework 4.8.1 ja muud versioonid
Toode Versioonid
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

Paste(Point)

Pastes the contents of the Clipboard to the InkCanvas at a given point.

public void Paste (System.Windows.Point point);

Parameters

point
Point

The point at which to paste the strokes.

Examples

The following example copies an element to the Clipboard and pastes it to the InkCanvas. This example assumes that there is an element called rect1, and that the Click events are connected to the event handlers in the example.

void copyXamlButton_Click(object sender, RoutedEventArgs e)
{
    string rectString = XamlWriter.Save(rect1);

    DataObject rectangleData = new DataObject(DataFormats.Xaml, rectString);
    Clipboard.SetDataObject(rectangleData);
}

void pasteButton_Click(object sender, RoutedEventArgs e)
{
    if (inkCanvas1.CanPaste())
    {
        inkCanvas1.Paste(new Point(100, 100));
    }
}

Remarks

The InkCanvas can support Clipboard data in Extensible Application Markup Language (XAML) format, Ink Serialized Format (ISF), and text format.

See also

Applies to

.NET Framework 4.8.1 ja muud versioonid
Toode Versioonid
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9