在控件进入和离开时自动开启、关闭中文输入法

[DllImport("user32")]
        private static extern uint ActivateKeyboardLayout(uint hkl, uint Flags);




private void comboboxEdit_Enter(object sender, EventArgs e)
        {
            InitData(sender);
            try
            {
                ActivateKeyboardLayout(1, 1);
            }
            catch (Exception ex)
            {
            }
        }

        private void comboboxEdit_Leave(object sender, EventArgs e)
        {
            try
            {
                ActivateKeyboardLayout(0, 1);
            }
            catch (Exception ex)
            {
            }
        }

posted @   禹过天晴  阅读(351)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示