private void TextBoxControl_HandleCreated(object sender, EventArgs e)
 {
     if (this.adapter != null)
     {
         return;
     }
     this.adapter = new NativeWindowAdapter(this.TextBoxItem.TextBoxControl.Handle);
     this.adapter.AddPostWndProcHook(new WndHookDelegate(this.WndProc));
 }
Beispiel #2
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;
 }
Beispiel #3
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();
 }