| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1227 人关注过本帖
标题:c#控制输入法
只看楼主 加入收藏
唐伯猫
Rank: 8Rank: 8
等 级:贵宾
威 望:45
帖 子:5323
专家分:58
注 册:2005-8-9
结帖率:25%
收藏
 问题点数:0 回复次数:2 
c#控制输入法

窗体中有一个richtextbox,combobox,button.
相应代码如下:
private void Form1_Load(object sender, System.EventArgs e)
{
InputLanguageCollection ilc = InputLanguage.InstalledInputLanguages;
  foreach ( InputLanguage il in ilc )
  {
   comboBox1.Items.Add( il.LayoutName );
  }
  comboBox1.SelectedIndex = InputLanguage.InstalledInputLanguages.IndexOf(InputLanguage.CurrentInputLanguage ) ;
}

private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
InputLanguage il = InputLanguage.InstalledInputLanguages[ comboBox1.SelectedIndex ];
  InputLanguage.CurrentInputLanguage = il;

}

private void button1_Click(object sender, System.EventArgs e)
{
this.Close();
}


在原文件中,还有这样的一些代码:
private void ChangeInput(object sender, System.Windows.Forms.InputLanguageChangedEventArgs e)
{
  InputLanguage il = e.InputLanguage ;
  int i = InputLanguage.InstalledInputLanguages.IndexOf( il );
  if( i >= 0 && i < InputLanguage.InstalledInputLanguages.Count )
  {
   comboBox1.SelectedIndex = i ;
  }
}
有没有都是一样的运行结果,不知道起到了什么作用?
大家说说看。

搜索更多相关主题的帖子: 输入法 ilc void private sender 
2005-12-01 15:07
live41
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:67
帖 子:12442
专家分:0
注 册:2004-7-22
收藏
得分:0 

An input language is a culture/keyboard layout pair that determines how the physical keys on a keyboard map or plot to characters in a language.

Use the static (Shared in Visual Basic) methods provided to find all installed mappings of the system and to change the input language for a thread or process. Call CurrentInputLanguage to get the current input language. Call DefaultInputLanguage for the default input language. Call InstalledInputLanguages to get all the installed languages in this system. Once you have a list of all the installed languages, use CurrentInputLanguage to change the current input language to a different language.


[C#]
public void GetLanguages() {
// Gets the list of installed languages.
foreach(InputLanguage lang in InputLanguage.InstalledInputLanguages) {
textBox1.Text += lang.Culture.EnglishName + '\n';
}
}

2005-12-02 15:39
houyunqing
Rank: 1
等 级:新手上路
帖 子:476
专家分:0
注 册:2005-4-1
收藏
得分:0 
说到输入法,嗯...有个问题,不知道有人知道不,就是与输入法进行交流

"魔力宝贝"(一个网络游戏),它的文字输入部分是他们自己做的,但是所使用的输入法跟自己机器上的输入法没有任何区别,对那些"自造词"也能够正确地显示提示(例如微软拼音的和全拼的提示),可以肯定,它是获得了某些信息,然后传送给输入法,然后再从输入法得到了应该显示的提示,那这是怎么做的呢?API?还是什么?迷茫中...

寻求挑战,追求完美 Oh,my god!
2005-12-03 11:28
快速回复:c#控制输入法
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018867 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved