在控件进入和离开时自动开启、关闭中文输入法
[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)
{
}
}