private void SelectImage() { // We don't want a selection changed event to fire during the initial insert. if (_invocationSource == ImageDecoratorInvocationSource.InitialInsert) { return; } IHTMLTextContainer textContainer = ((IHTMLDocument2)_element.document).body as IHTMLTextContainer; IHTMLControlRange controlRange = textContainer.createControlRange() as IHTMLControlRange; controlRange.add(_element as IHTMLControlElement); controlRange.select(); }
public void UpdateSelection(IHTMLControlRange selection) { if (selection != null) selection.select(); //fire the selection changed event since the IHTMLControlRange object doesn't (MshtmlEditor.MshtmlControl.DocumentEvents as HTMLDocumentEvents2).onselectionchange(null); }