コード例 #1
0
 protected override void OnImeModeChanged(EventArgs e)
 {
     if (WebView.HaveValue)
     {
         ImeContext.SetImeStatus(ImeMode, Handle);
     }
     base.OnImeModeChanged(e);
 }
コード例 #2
0
        public Browser()
        {
            InitializeComponent();
            if (IsDesignMode)
            {
                return;
            }
            WebView = mbWebView.Create();

            TitleChanged           = new EventAdapter <TitleChangeEventArgs, mbTitleChangedCallback>(this, NativeMethods.mbOnTitleChanged);
            UrlChanged             = new EventAdapter <UrlChangeEventArgs, mbURLChangedCallback>(this, NativeMethods.mbOnURLChanged);
            NewWindow              = new EventAdapter <NewWindowEventArgs, mbCreateViewCallback>(this, NativeMethods.mbOnCreateView);
            LoadUrlBegin           = new EventAdapter <LoadUrlBeginEventArgs, mbLoadUrlBeginCallback>(this, NativeMethods.mbOnLoadUrlBegin);
            WebSocketOnWillConnect = new EventAdapter <WebSocketWillConnectEventArgs, onWillConnect>(this, RegSocketOnWillConnect);
            WebSocketOnConnect     = new EventAdapter <WebSocketConnectedEventArgs, onConnected>(this, RegSocketOnConnected);
            WebSocketOnReceive     = new EventAdapter <WebSocketDataEventArgs, onReceive>(this, RegSocketOnReceive);
            WebSocketOnSend        = new EventAdapter <WebSocketDataEventArgs, onSend>(this, RegSocketOnSend);
            WebSocketOnError       = new EventAdapter <WebSocketErrorEventArgs, onError>(this, RegSocketOnError);
            LoadUrlEnd             = new EventAdapter <LoadUrlEndEventArgs, mbLoadUrlEndCallback>(this, NativeMethods.mbOnLoadUrlEnd);
            DocumentReady          = new EventAdapter <DocumentReadyEventArgs, mbDocumentReadyCallback>(this, NativeMethods.mbOnDocumentReady);
            JsQuery  = new EventAdapter <OnJsQueryEventArgs, mbJsQueryCallback>(this, NativeMethods.mbOnJsQuery);
            DownLoad = new EventAdapter <DownloadEventArgs, mbDownloadCallback>(this, NativeMethods.mbOnDownload);
            DownLoadInBlinkThread      = new EventAdapter <DownloadDownloadInBlinkThreadEventArg, mbDownloadInBlinkThreadCallback>(this, NativeMethods.mbOnDownloadInBlinkThread);
            _mbPaintUpdatedCallback    = new mbPaintUpdatedCallback(OnPaintUpdate);
            _mbPaintBitUpdatedCallback = new mbPaintBitUpdatedCallback(mbPaintBitUpdated);

            NativeMethods.mbSetAutoDrawToHwnd(WebView, true);
            NativeMethods.mbOnPaintUpdated(WebView, _mbPaintUpdatedCallback, IntPtr.Zero);
            //NativeMethods.mbOnPaintBitUpdated(WebView, _mbPaintBitUpdatedCallback, IntPtr.Zero);
            if (!IsHandleCreated)
            {
                CreateHandle();
            }
            WebView.SetHandle(Handle);
            ImeContext.SetImeStatus(ImeMode.NoControl, Handle);
            ImeMode        = ImeMode.Off;
            Disposed      += Browser_Disposed;
            DoubleBuffered = true;
        }