.net winform程序中,经常要判断电脑是否安装输入法,如果没有安装,则下载输入法进行安装.
1.首先第一步是获取输入法并判断输入法:
InputLanguage.InstalledInputLanguages
2.设置输入法
private void zbtnsubmit_Click(object sender, EventArgs e)
{
if (InputLanguage.InstalledInputLanguages == null) { return; }
if (InputLanguage.InstalledInputLanguages.Count <= 0) { MessageBox.Show("未安装输入法"); return; }
InputLanguage currentLanguage = InputLanguage.InstalledInputLanguages[zcmb.SelectedIndex];
InputLanguage.CurrentInputLanguage = currentLanguage;
MessageBox.Show("系统输入法设置成功!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
}