//将本机上的输入法读入Listbox中供用户选择
procedure TForm6.FormCreate(Sender: TObject);
begin
ListBox1.Items:=Screen.Imes;
end;
//保存用户选择的输入法
procedure TForm6.SpeedButton1Click(Sender: TObject);
var
MyIni: TIniFile;
begin
MyIni := TIniFile.Create('./appset/Setup.ini');
MyIni.WriteString('Imes', 'Imes', ListBox1.Items.Strings[ListBox1.ItemIndex]);
Form1.MyImes:= ListBox1.Items.Strings[ListBox1.ItemIndex];
close;
end;
//读入设置
procedure TForm1.FormShow(Sender: TObject);
var
MyIni: TIniFile;
begin
MyIni := TIniFile.Create('./appset/Setup.ini');
MyImes:=MyIni.ReadString('Imes', 'Imes', '紫光拼音输入法2.2版');
Caption:=MyIni.ReadString('WorkGroup', 'GroupName', '未知');
Server_ODBC:=MyIni.ReadString('Server ODBC', 'ODBC', 'SQL_MIS');
......
//将用户设置的输入法赋值给编辑控件
Procedure TForm2.SetIme;
var
i:Integer;
begin
for i:=ComponentCount-1 DownTo 0 do
begin
if (Components is TEdit) then (Components as TEdit).ImeName:=Form1.MyImes;
if (Components is TCombobox) then (Components as TCombobox).ImeName:=Form1.MyImes;
end;
end;