Yes, this is possible. Details:
- Copy; To get currently selected text from a
TerminalControl
, call its GetSelectedText
method.
- Paste; To disable auto-paste, set
TerminalControl
's MousePasteEnabled
property to false
. To implement your own paste (in a popup menu), use the control's SendToServer
method to send the clipboard text.
Sample code for copy/paste popup menu items event handlers:
// Copy
private void copyItem_Click(object sender, EventArgs e)
{
string text = terminal.GetSelectedText();
if (text != null)
Clipboard.SetText(text);
}
// Paste
private void pasteItem_Click(object sender, EventArgs e)
{
if (Clipboard.ContainsText(TextDataFormat.Text) || Clipboard.ContainsText(TextDataFormat.UnicodeText))
{
string text = Clipboard.GetText();
if (text != null)
terminal.SendToServer(text);
}
}