Пример #1
0
        void CreateContext()
        {
            if (this.textArea == null)
            {
                return;
            }
            //Dirkster99 BugFix
            if (this.textArea.Options == null)
            {
                return;
            }

            if (!textArea.Options.EnableImeSupport)
            {
                return;
            }
            hwndSource = (HwndSource)PresentationSource.FromVisual(this.textArea);
            if (hwndSource != null)
            {
                currentContext  = ImeNativeWrapper.GetContext(hwndSource);
                previousContext = ImeNativeWrapper.AssociateContext(hwndSource, currentContext);
//				ImeNativeWrapper.SetCompositionFont(hwndSource, currentContext, textArea);
                hwndSource.AddHook(WndProc);
            }
        }
Пример #2
0
 void ClearContext()
 {
     if (hwndSource != null)
     {
         hwndSource.RemoveHook(WndProc);
         ImeNativeWrapper.AssociateContext(hwndSource, previousContext);
         previousContext = IntPtr.Zero;
         ImeNativeWrapper.ReleaseContext(hwndSource, currentContext);
         hwndSource     = null;
         currentContext = IntPtr.Zero;
     }
 }