Search
DiagramView.PasteFromClipboard Method (Single, Single)
See Also
 





Pastes diagram items from the Windows clipboard.

Namespace: MindFusion.Diagramming.WinForms
Assembly: MindFusion.Diagramming.WinForms

 Syntax

C#  Copy Code

public bool PasteFromClipboard (
    float dx,
    float dy
)

Visual Basic  Copy Code

Public Function PasteFromClipboard( _
    dx As Single, _
    dy As Single _
) As Boolean

 Parameters

dx
The horizontal offset of pasted items from their original positions.
dy
The vertical offset of pasted items from their original positions.

 Return Value

true if successful; otherwise, false.

 Remarks

If MindFusion.Diagramming items are available in the clipboard, this method clones them and adds them to the current diagram. Non-zero dx / dy offset is useful when pasting items several times consecutively, so the pasted items don't overlay the original ones completely.

 Example

Copying and pasting can be implemented like that:

C#  Copy Code

private float pasteDX;
private float pasteDY;

private void miCopy_Click(object sender, System.EventArgs e)
{
    diagramView.CopyToClipboard(true);
    pasteDX = 0;
    pasteDY = 0;
}

private void miPaste_Click(object sender , System.EventArgs e)
{
    pasteDX += 10;
    pasteDY += 10;
    diagramView.PasteFromClipboard(pasteDX, pasteDY);
}

Visual Basic  Copy Code

Private pasteDX As Single
Private pasteDY As Single

Private Sub miCopy_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miCopy.Click

    diagramView.CopyToClipboard(True)
    pasteDX = 0
    pasteDY = 0

End Sub

Private Sub miPaste_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles miPaste.Click

    pasteDX += 10
    pasteDY += 10
    diagramView.PasteFromClipboard(pasteDX, pasteDY)

End Sub

 See Also