Simpler, more efficient, more practical C # Input Method control

Source: Internet
Author: User

      recently because the project needs to control the input method, but there are a variety of attempts, there is always a bad place.

     if the use of control IMEMode properties or some of the online search methods, it is too cumbersome to develop, it is not control in place. After repeated attempts to obtain a relatively simple, effective and practical control methods to share with you. The code is small, but it's very good. using system; using system.collections.generic; using system.text; using system.windows.forms; Namespace sysclasslib.tools {   public class imecontrol:object      {        private static int IMECurIndex=0;          public static void imeclose (object sender,  Eventargs e)         {             //get when Input method number             Imecurindex = inputlanguage.installedinputlanguages.indexof (Inputlanguage.currentinputlanguage);                    & NBsp;   inputlanguage.currentinputlanguage = null;                     &NBSP}         public static void imeopen (object  Sender, eventargs e)         {           //restore Current Input method               inputlanguage.currentinputlanguage = inputlanguage.installedinputlanguages[imecurindex];        &NBSP}         //IME control method. This method is called when the form is installed and will require control of the input method, which can be included. No additional settings are required.         public static void imectrl (Control[]  Useimecontrols)         {             Adds event             foreach  to the specified control (control  Useimectl in useimecontrols)              {                 Useimectl.enter += new eventhandler (Imeopen);                  Useimectl.leave += new eventhandler (Imeclose);             }          }    &nbsp}}

I hope to reduce the confusion between you and me.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.