procedure TForm1.FormCreate(Sender: TObject); var I:integer; begin //初始化的时候,将电脑所安装的输入法列举加入Combobox1中。 for i:=0 to screen.Imes.Count-1 do combobox1.Items.Add(screen.Imes.Strings[i]); end;
procedure TForm1.ComboBox1Change(Sender: TObject); var I:integer; begin //--在输入法的选择改变后,重新设置控件的ImeName。 I:=0 to self.ComponentCount-1 do begin //以下是设置Edit、Memo、Combobox的输入法,其它控件改变类名即可。 if (self.Components[i].ClassNameIs('Tedit')) then (self.Components[i] as tedit).ImeName :=ComboBox1.Text; if (self.Components[i].ClassNameIs('Tmemo')) then (self.Components[i] as tmemo).ImeName :=ComboBox1.Text; if (self.Components[i].ClassNameIs('Tcombobox')) then (self.Components[i] as tcombobox).ImeName :=ComboBox1.Text; end; end;