Internet Explorer 9 RC stops my WinForms WebBrowser control to work in editing mode

后端 未结 9 1776
渐次进展
渐次进展 2020-12-09 13:45

Using the IHtmlDocument2.designMode property set to On to switch a WebBrowser control hosted on a Windows Forms form to editing mode suddenly stopp

相关标签:
9条回答
  • 2020-12-09 14:40

    Yesterday, Internet Explorer 9 RTM finally was released.

    I did some more tiny adjustments to my control, but basically the idea with the intergrated, small web server seems to work rather well.

    So the solution is in this Code Project article:

    Zeta HTML Edit Control
    A small wrapper class around the Windows Forms 2.0 WebBrowser control

    This was the only solution that worked for me.

    I hope it is OK to answer my own question and mark my answer as "answered", too?!?

    0 讨论(0)
  • 2020-12-09 14:43

    What's your exact code?

    If I set the following code:

        private void cbDesign_CheckedChanged(object sender, EventArgs e){
            var instance =
        Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(
        wbView.ActiveXInstance,
        null,
        @"Document",
        new object[0],
        null,
        null, null );
    
             var objArray1 = new object[] { cbDesign.Checked ? @"On" : @"Off" };
    
        Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateSetComplex(
        instance,
        null,
        @"designMode",
        objArray1,
        null,
        null,
        false,
        true );
    

    The IE9 Web Browser instance enters designMode without any problems. If you change the "Zeta" example to not set the document text after entering design mode, it also works fine.

    0 讨论(0)
  • 2020-12-09 14:45

    I had a similar problem and got around it by adding the following line to the DocumentCompleted event:

     ((HTMLBody)_doc.body).contentEditable = "true";
    
    0 讨论(0)
提交回复
热议问题