Ejemplo n.º 1
0
 public static bool ReleaseContext(IntPtr source, IntPtr hIMC)
 {
     if (hIMC != IntPtr.Zero)
     {
         return(IMENativeWrapper.ImmReleaseContext(source, hIMC));
     }
     return(false);
 }
Ejemplo n.º 2
0
 public static bool SetCompositionWindow(
     IntPtr hIMC,
     RadTextBoxControlElement caretTextBox,
     Point point)
 {
     ImeHelper.SetCompositionFont(caretTextBox, hIMC);
     return(IMENativeWrapper.ImmSetCompositionWindow(hIMC, ref new IMENativeWrapper.CompositionForm()
     {
         dwStyle = 32, ptCurrentPos = { x = Math.Max(0, point.X), y = Math.Max(0, point.Y) }
     }));
 }
Ejemplo n.º 3
0
 public static void EnableImmComposition()
 {
     if (ImeHelper.threadMgrFailed)
     {
         return;
     }
     if (ImeHelper.threadMgr == null)
     {
         IMENativeWrapper.TF_CreateThreadMgr(out ImeHelper.threadMgr);
         if (ImeHelper.threadMgr == null)
         {
             ImeHelper.threadMgrFailed = true;
             return;
         }
     }
     ImeHelper.threadMgr.SetFocus(IntPtr.Zero);
 }
Ejemplo n.º 4
0
        public static string GetImmCompositionString(IntPtr immContext, int dwIndex)
        {
            int compositionStringW1 = IMENativeWrapper.ImmGetCompositionStringW(immContext, dwIndex, (StringBuilder)null, 0);

            if (compositionStringW1 < 0)
            {
                return((string)null);
            }
            StringBuilder lpBuf = new StringBuilder(compositionStringW1 / 2);
            int           compositionStringW2 = IMENativeWrapper.ImmGetCompositionStringW(immContext, dwIndex, lpBuf, compositionStringW1);

            if (compositionStringW2 < 0)
            {
                return((string)null);
            }
            return(lpBuf.ToString().Substring(0, compositionStringW2 / 2));
        }
Ejemplo n.º 5
0
        private static void SetCompositionFont(RadTextBoxControlElement caretTextBox, IntPtr hIMC)
        {
            double height = (double)caretTextBox.Font.Height;

            IMENativeWrapper.LOGFONT logfont = new IMENativeWrapper.LOGFONT()
            {
                lfHeight = (int)height, lfFaceName = caretTextBox.Font.FontFamily.Name
            };
            IntPtr num = Marshal.AllocHGlobal(Marshal.SizeOf((object)logfont));

            try
            {
                Marshal.StructureToPtr((object)logfont, num, true);
                IMENativeWrapper.ImmSetCompositionFontW(hIMC, num);
            }
            finally
            {
                Marshal.FreeHGlobal(num);
            }
        }
Ejemplo n.º 6
0
 public static IntPtr GetDefaultIMEWnd()
 {
     return(IMENativeWrapper.ImmGetDefaultIMEWnd(IntPtr.Zero));
 }
Ejemplo n.º 7
0
 public static bool NotifyCompositionStringCancel(IntPtr hIMC)
 {
     return(IMENativeWrapper.ImmNotifyIME(hIMC, 21, 4, 0));
 }
Ejemplo n.º 8
0
 public static IntPtr AssociateContext(NativeWindow source, IntPtr hIMC)
 {
     return(IMENativeWrapper.ImmAssociateContext(source.Handle, hIMC));
 }
Ejemplo n.º 9
0
 public static IntPtr GetContext(IntPtr source)
 {
     return(IMENativeWrapper.ImmGetContext(source));
 }