Ejemplo n.º 1
0
 private void ClearContext()
 {
     if (this.immSource == null)
     {
         return;
     }
     this.immSource.RemoveHook(new WndHookDelegate(this.WndProc));
     ImeHelper.AssociateContext((NativeWindow)this.immSource, this.imeOldContext);
     this.imeOldContext = IntPtr.Zero;
     ImeHelper.ReleaseContext(this.imeDefaultWnd, this.imeContext);
     this.immSource.Dispose();
     this.immSource     = (NativeWindowAdapter)null;
     this.imeContext    = IntPtr.Zero;
     this.imeDefaultWnd = IntPtr.Zero;
 }
Ejemplo n.º 2
0
 private void CreateContext()
 {
     if (this.textBoxControl.ElementTree == null || this.textBoxControl.ElementTree.Control == null || (this.textBoxControl.IsDisposed || this.textBoxControl.ElementTree.Control.IsDisposed))
     {
         return;
     }
     if (this.immSource != null && this.immSource.Handle != this.textBoxControl.ElementTree.Control.Handle)
     {
         this.immSource.Dispose();
     }
     this.immSource = new NativeWindowAdapter(this.textBoxControl.ElementTree.Control.Handle);
     if (this.immSource == null)
     {
         return;
     }
     this.imeDefaultWnd = ImeHelper.GetDefaultIMEWnd();
     this.imeContext    = ImeHelper.GetContext(this.imeDefaultWnd);
     this.imeOldContext = ImeHelper.AssociateContext((NativeWindow)this.immSource, this.imeContext);
     this.immSource.AddHook(new WndHookDelegate(this.WndProc));
     ImeHelper.EnableImmComposition();
 }