private void ProcessPasteFromWebBrowser()
{
if (_beginSelection)
{
_beginSelection = false;
var activeControl = FormManager.LastActiveControl as TextBox;
if (activeControl != null && webBrowser.Document != null)
{
var htmlDocument = webBrowser.Document.DomDocument as IHTMLDocument2;
if (htmlDocument != null)
{
IHTMLSelectionObject currentSelection = htmlDocument.selection;
if (currentSelection != null)
{
var range = currentSelection.createRange() as IHTMLTxtRange;
if (range != null)
activeControl.SelectedText = range.text;
}
}
}
}
}