Copies the current selection to the Clipboard.
Namespace:
C1.Win.XmlEditorAssembly:
C1.Win.XmlEditor.2 (in C1.Win.XmlEditor.2.dll)
Syntax
| Visual Basic (Declaration) |
|---|
Public Sub Copy |
Examples
This example shows how to create a custom context menu that can be linked to a C1XmlEditor control and has Cut, Copy and Paste buttons.
Copy CodeC#
class MyContextMenuStrip : ContextMenuStrip
{
private C1XmlEditor _owner;
private ToolStripMenuItem _btnCut, _btnCopy, _btnPaste;
public MyContextMenuStrip(C1XmlEditor editor)
{
_owner = editor;
_btnCut = (ToolStripMenuItem)Items.Add("Cut");
_btnCut.ShortcutKeys = Keys.Control | Keys.X;
_btnCopy = (ToolStripMenuItem)Items.Add("Copy");
_btnCopy.ShortcutKeys = Keys.Control | Keys.C;
_btnPaste = (ToolStripMenuItem)Items.Add("Paste");
_btnPaste.ShortcutKeys = Keys.Control | Keys.V;
}
protectedoverridevoid OnItemClicked(ToolStripItemClickedEventArgs e)
{
Close();
if (e.ClickedItem == _btnCopy)
_owner.Copy();
elseif (e.ClickedItem == _btnCut)
_owner.Cut();
elseif (e.ClickedItem == _btnPaste)
_owner.Paste();
base.OnItemClicked(e);
}
protectedoverridevoid OnOpening(System.ComponentModel.CancelEventArgs e)
{
_btnCopy.Enabled = _owner.CanCopy;
_btnCut.Enabled = _owner.CanCut;
_btnPaste.Enabled = _owner.CanPaste || _owner.CanPasteAsText;
base.OnOpening(e);
} |
See Also