I'm writing a .NET forms control to edit HTML using MSHTML. I am creating some custom elements and want to make them effectively read-only. I thought I could go about this by focusing on the entire element any time focus entered anywhere in that element but the HtmlElement.Focus() doesn't select the entire element and I don't seem to be able to capture entry of the cursor.
Another option would be to raise an event whenever the text of the element is changed (on KeyDown I expect) but I can't get that event to fire, either. Any ideas about why my expectations about event behavior is wrong or alternate suggestions for implementation?
I found that setting the attribute:
Resulted in the desired behavior.