protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { //if ((keyData == (Keys.Control | Keys.C))) //{ // //your implementation // return true; //} if ((keyData == (Keys.Control | Keys.V))) { //ClipboardAsync Clipboard2 = new ClipboardAsync(); //string ptxt = Clipboard2.GetText(TextDataFormat.UnicodeText).Replace(Environment.NewLine, "\r\n"); //cbxInput.Text += ptxt; //return true; ClipboardAsync Clipboard2 = new ClipboardAsync(); string insertText = Clipboard2.GetText(TextDataFormat.UnicodeText).Replace(Environment.NewLine, "\r\n"); int selectionIndex = cbxInput.SelectionStart; cbxInput.Text = cbxInput.Text.Insert(selectionIndex, insertText); cbxInput.SelectionStart = selectionIndex + insertText.Length; return(true); } else { return(base.ProcessCmdKey(ref msg, keyData)); } }
public string GetText(TextDataFormat format) { ClipboardAsync instance = new ClipboardAsync(); Thread staThread = new Thread(instance._thGetText); staThread.SetApartmentState(ApartmentState.STA); staThread.Start(format); staThread.Join(); return instance._GetText; }
public System.Collections.Specialized.StringCollection GetFileDropList() { ClipboardAsync instance = new ClipboardAsync(); Thread staThread = new Thread(instance._thGetFileDropList); staThread.SetApartmentState(ApartmentState.STA); staThread.Start(); staThread.Join(); return instance._GetFileDropList; }
public bool ContainsText(object format) { ClipboardAsync instance = new ClipboardAsync(); Thread staThread = new Thread(instance._thContainsFileDropList); staThread.SetApartmentState(ApartmentState.STA); staThread.Start(format); staThread.Join(); return instance._ContainsText; }
public bool ContainsText(object format) { ClipboardAsync instance = new ClipboardAsync(); Thread staThread = new Thread(instance._thContainsFileDropList); staThread.SetApartmentState(ApartmentState.STA); staThread.Start(format); staThread.Join(); return(instance._ContainsText); }
public string GetText(TextDataFormat format) { ClipboardAsync instance = new ClipboardAsync(); Thread staThread = new Thread(instance._thGetText); staThread.SetApartmentState(ApartmentState.STA); staThread.Start(format); staThread.Join(); return(instance._GetText); }
public System.Collections.Specialized.StringCollection GetFileDropList() { ClipboardAsync instance = new ClipboardAsync(); Thread staThread = new Thread(instance._thGetFileDropList); staThread.SetApartmentState(ApartmentState.STA); staThread.Start(); staThread.Join(); return(instance._GetFileDropList); }
protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { //if ((keyData == (Keys.Control | Keys.C))) //{ // //your implementation // return true; //} if ((keyData == (Keys.Control | Keys.V))) { //ClipboardAsync Clipboard2 = new ClipboardAsync(); //string ptxt = Clipboard2.GetText(TextDataFormat.UnicodeText).Replace(Environment.NewLine, "\r\n"); //cbxInput.Text += ptxt; //return true; ClipboardAsync Clipboard2 = new ClipboardAsync(); string insertText = Clipboard2.GetText(TextDataFormat.UnicodeText).Replace(Environment.NewLine, "\r\n"); int selectionIndex = cbxInput.SelectionStart; cbxInput.Text = cbxInput.Text.Insert(selectionIndex, insertText); cbxInput.SelectionStart = selectionIndex + insertText.Length; return true; } else { return base.ProcessCmdKey(ref msg, keyData); } }
private void cbxInput_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) e.SuppressKeyPress = true; if (e.Control && e.KeyCode == Keys.V) { //e.Handled = true; ClipboardAsync Clipboard2 = new ClipboardAsync(); //string ptxt = Clipboard2.GetText(TextDataFormat.UnicodeText).Replace(Environment.NewLine, "\r\n"); //cbxInput.Text += ptxt; ////Clipboard.SetText(" "); ////Clipboard.Clear(); ////string fgt = Clipboard.GetText(); ////Clipboard.SetText(ptxt); ////////pasted = true; ////string ptxt = Clipboard.GetText().Replace(Environment.NewLine, "\r\n"); ////Clipboard.SetText(" "); ////string fgt = Clipboard.GetText(); ////Clipboard.Clear(); ////Clipboard.SetText(ptxt); ////cbxInput.Text += ptxt; string insertText = Clipboard2.GetText(TextDataFormat.UnicodeText).Replace(Environment.NewLine, "\r\n"); int selectionIndex = textBox1.SelectionStart; cbxInput.Text = cbxInput.Text.Insert(selectionIndex, insertText); cbxInput.SelectionStart = selectionIndex + insertText.Length; } }