Exemplo n.º 1
0
        /// <summary>
        /// Create the MSHTML control and add it to our client area
        /// </summary>
        private void InitializeMshtmlControl(IServiceProviderRaw serviceProvider, MshtmlOptions mshtmlOptions, bool protectFocus)
        {
            UpdateOptions(mshtmlOptions, true);

            // initialize mshtml control
            mshtmlControl = new MshtmlControl(serviceProvider, protectFocus);
            mshtmlControl.InstallDocHostUIHandler(this);
            mshtmlControl.SetDLControlFlags(mshtmlOptions.DLCTLOptions);
            mshtmlControl.Init();
            mshtmlControl.SetEditMode(true);

            // get a reference to the htmlDocument
            htmlDocument = mshtmlControl.HTMLDocument;

            /// Hook Mshtml document GotFocus so we can notify .NET when our control
            /// gets focus (allows Enter and Leave events to be fired correctly so
            /// that commands can be managed correctly)
            mshtmlControl.DocumentEvents.GotFocus += new EventHandler(DocumentEvents_GotFocus);

            // add the control to our client area
            mshtmlControl.Dock = DockStyle.Fill;
            Controls.Add(mshtmlControl);
        }