问个简体转繁体的问题(送100分) 我用DELPHI写了个软件 是简体字的 然后发给了我朋友 是台湾人 有没有什么办法可以将我软件里的字体都变成繁体字(我要求一次性转换成型的) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用peexplore,exeScope等exe修改器改改,不过只能修改窗体,其他的还须在程序里改 哈哈,这问题简单嘛打开软件的源工程,在Delphi中Project -> Languages -> Add如果要自动简繁转换得写代码了 从别处贴过来的,希望对你有点帮助,通过读写资源文件就可进行简繁转换。网上简繁转换的源码一大堆哈unit MaltiLan;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms;procedure ReinitializeForms;function LoadNewResourceModule(Locale: LCID): Longint;implementationtype TAsInheritedReader = class(TReader) Public procedure ReadPrefix(var Flags: TFilerFlags; var AChildPos: Integer); Override; end;procedure TAsInheritedReader.ReadPrefix(var Flags: TFilerFlags; var AChildPos: Integer);begin inherited ReadPrefix(Flags, AChildPos); Include(Flags, ffInherited);end;function SetResourceHInstance(NewInstance: Longint): Longint;var CurModule: PLibModule;begin CurModule := LibModuleList; Result := 0; while CurModule <> nil do begin if CurModule.Instance = HInstance then begin if CurModule.ResInstance <> CurModule.Instance then FreeLibrary(CurModule.ResInstance); CurModule.ResInstance := NewInstance; Result := NewInstance; Exit; end; CurModule := CurModule.Next; end;end;function LoadNewResourceModule(Locale: LCID): Longint;var FileName: array[0..260] of char; P: PChar; LocaleName: array[0..4] of Char; NewInst: Longint;begin GetModuleFileName(HInstance, FileName, SizeOf(FileName)); GetLocaleInfo(Locale, LOCALE_SABBREVLANGNAME, LocaleName, SizeOf(LocaleName)); P := PChar(@FileName) + lstrlen(FileName); while (P^ <> '.') and (P <> @FileName) do Dec(P); NewInst := 0; Result := 0; if P <> @FileName then begin Inc(P); if LocaleName[0] <> #0 then begin // Then look for a potential language/country translation lstrcpy(P, LocaleName); NewInst := LoadLibraryEx(FileName, 0, LOAD_LIBRARY_AS_DATAFILE); if NewInst = 0 then begin // Finally look for a language only translation LocaleName[2] := #0; lstrcpy(P, LocaleName); NewInst := LoadLibraryEx(FileName, 0, LOAD_LIBRARY_AS_DATAFILE); end; end; end; if NewInst <> 0 then Result := SetResourceHInstance(NewInst)end;function InternalReloadComponentRes(const ResName: string; HInst: THandle; var Instance: TComponent): Boolean;var HRsrc: THandle; ResStream: TResourceStream; AsInheritedReader: TAsInheritedReader;begin { avoid possible EResNotFound exception } if HInst = 0 then HInst := HInstance; HRsrc := FindResource(HInst, PChar(ResName), RT_RCDATA); Result := HRsrc <> 0; if not Result then Exit; ResStream := TResourceStream.Create(HInst, ResName, RT_RCDATA); try AsInheritedReader := TAsInheritedReader.Create(ResStream, 4096); try Instance := AsInheritedReader.ReadRootComponent(Instance); finally AsInheritedReader.Free; end; finally ResStream.Free; end; Result := True;end;function ReloadInheritedComponent(Instance: TComponent; RootAncestor: TClass): Boolean; function InitComponent(ClassType: TClass): Boolean; begin Result := False; if (ClassType = TComponent) or (ClassType = RootAncestor) then Exit; Result := InitComponent(ClassType.ClassParent); Result := InternalReloadComponentRes(ClassType.ClassName, FindResourceHInstance( FindClassHInstance(ClassType)), Instance) or Result; end;begin Result := InitComponent(Instance.ClassType);end;procedure ReinitializeForms;var Count: Integer; I: Integer; Form: TForm;begin Count := Screen.FormCount; for I := 0 to Count - 1 do begin Form := Screen.Forms[I]; ReloadInheritedComponent(Form, TForm); end;end;end.测试程序窗体单元文件如下 :/// 单元文件名 :unit1.pasunit Unit1;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Menus, MLanTool, ExtCtrls, StdCtrls;type TForm1 = class(TForm) MainMenu1: TMainMenu; File1: TMenuItem; Exit1: TMenuItem; Language1: TMenuItem; Chese1: TMenuItem; English1: TMenuItem; Button1: TButton; Memo1: TMemo; ListBox1: TListBox; GroupBox1: TGroupBox; Panel1: TPanel; procedure Exit1Click(Sender: TObject); procedure Chese1Click(Sender: TObject); procedure English1Click(Sender: TObject); Private { Private declarations } Public { Public declarations } end;var Form1: TForm1;implementation{$R *.DFM}const ENGLISH = (SUBLANG_ENGLISH_US shl 10) or LANG_ENGLISH; CHINESE = (SUBLANG_CHINESE_SIMPLIFIED shl 10) or LANG_CHINESE;procedure TForm1.Exit1Click(Sender: TObject);begin Close;end;procedure TForm1.Chese1Click(Sender: TObject);begin if LoadNewResourceModule(CHINESE) <> 0 then ReinitializeForms;end;procedure TForm1.English1Click(Sender: TObject);begin if LoadNewResourceModule(ENGLISH) <> 0 then ReinitializeForms;end;end.如果要自动切换语言 ,只要在 FormCreate 事件中添加如下代码即可 : if LoadNewResourceModule(SysLocale.DefaultLCID) <> 0 then ReinitializeForms; king_xing 你这好象是 中 英 的转换吧 我是简体 和繁体 而且 我把我的简体软件发给朋友(台湾) 他连接不了我的SQL数据库 内地就能连(我确定不是网络原因) 打开软件的源工程,在Delphi中Project -> Languages -> Add 这个方法能有用吗 我试了下弄不来 如果可以的话 应该比较简单吧 补充下:我用了个 转换软件 把我DELPHI 的里所以代码和文字都转成繁体了 但是有个问题 就是 连接SQL出错 是知道 这个问题怎么解决 我就接分了 求救!关于delphi的odac安装问题!~~ 现在那个程序界面控件组比较好用!!! 关于循环的棘手控制问题!!!! 请高手指点一下!!!!! 一个连接数据库的问题,98连接WIN 2000Server为什么不行? xywhx(xywhx)进来拿分(4) table1的field1是数字类型,这个数字对应于table2的ID,table2还有name字段,如何编辑table1 怎样学习Object Pascal? 在一个单元中,接口部分和实现部分的Use有什么区别?谢谢! 请问谁有用DELPHI的开发B/S结构的软件的资料? delphi 请教一个问题!
其他的还须在程序里改
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms;
procedure ReinitializeForms;function LoadNewResourceModule(Locale: LCID): Longint;
implementation
type TAsInheritedReader = class(TReader) Public procedure ReadPrefix(var Flags: TFilerFlags; var AChildPos: Integer); Override; end;
procedure TAsInheritedReader.ReadPrefix(var Flags: TFilerFlags; var AChildPos: Integer);begin inherited ReadPrefix(Flags, AChildPos); Include(Flags, ffInherited);end;
function SetResourceHInstance(NewInstance: Longint): Longint;var CurModule: PLibModule;begin CurModule := LibModuleList; Result := 0; while CurModule <> nil do begin if CurModule.Instance = HInstance then begin if CurModule.ResInstance <> CurModule.Instance then FreeLibrary(CurModule.ResInstance); CurModule.ResInstance := NewInstance; Result := NewInstance; Exit; end; CurModule := CurModule.Next; end;end;
function LoadNewResourceModule(Locale: LCID): Longint;var FileName: array[0..260] of char; P: PChar; LocaleName: array[0..4] of Char; NewInst: Longint;begin GetModuleFileName(HInstance, FileName, SizeOf(FileName)); GetLocaleInfo(Locale, LOCALE_SABBREVLANGNAME, LocaleName, SizeOf(LocaleName)); P := PChar(@FileName) + lstrlen(FileName); while (P^ <> '.') and (P <> @FileName) do Dec(P); NewInst := 0; Result := 0; if P <> @FileName then begin Inc(P); if LocaleName[0] <> #0 then begin // Then look for a potential language/country translation lstrcpy(P, LocaleName); NewInst := LoadLibraryEx(FileName, 0, LOAD_LIBRARY_AS_DATAFILE); if NewInst = 0 then begin // Finally look for a language only translation LocaleName[2] := #0; lstrcpy(P, LocaleName); NewInst := LoadLibraryEx(FileName, 0, LOAD_LIBRARY_AS_DATAFILE); end; end; end; if NewInst <> 0 then Result := SetResourceHInstance(NewInst)end;
function InternalReloadComponentRes(const ResName: string; HInst: THandle; var Instance: TComponent): Boolean;var HRsrc: THandle; ResStream: TResourceStream; AsInheritedReader: TAsInheritedReader;begin { avoid possible EResNotFound exception } if HInst = 0 then HInst := HInstance; HRsrc := FindResource(HInst, PChar(ResName), RT_RCDATA); Result := HRsrc <> 0; if not Result then Exit; ResStream := TResourceStream.Create(HInst, ResName, RT_RCDATA); try AsInheritedReader := TAsInheritedReader.Create(ResStream, 4096); try Instance := AsInheritedReader.ReadRootComponent(Instance); finally AsInheritedReader.Free; end; finally ResStream.Free; end; Result := True;end;
function ReloadInheritedComponent(Instance: TComponent; RootAncestor: TClass): Boolean;
function InitComponent(ClassType: TClass): Boolean; begin Result := False; if (ClassType = TComponent) or (ClassType = RootAncestor) then Exit; Result := InitComponent(ClassType.ClassParent); Result := InternalReloadComponentRes(ClassType.ClassName, FindResourceHInstance( FindClassHInstance(ClassType)), Instance) or Result; end;
begin Result := InitComponent(Instance.ClassType);end;
procedure ReinitializeForms;var Count: Integer; I: Integer; Form: TForm;begin Count := Screen.FormCount; for I := 0 to Count - 1 do begin Form := Screen.Forms[I]; ReloadInheritedComponent(Form, TForm); end;end;
end.测试程序窗体单元文件如下 :/// 单元文件名 :unit1.pasunit Unit1;
interface
uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Menus, MLanTool, ExtCtrls, StdCtrls;
type TForm1 = class(TForm) MainMenu1: TMainMenu; File1: TMenuItem; Exit1: TMenuItem; Language1: TMenuItem; Chese1: TMenuItem; English1: TMenuItem; Button1: TButton; Memo1: TMemo; ListBox1: TListBox; GroupBox1: TGroupBox; Panel1: TPanel; procedure Exit1Click(Sender: TObject); procedure Chese1Click(Sender: TObject); procedure English1Click(Sender: TObject); Private { Private declarations } Public { Public declarations } end;
var Form1: TForm1;
implementation
{$R *.DFM}const ENGLISH = (SUBLANG_ENGLISH_US shl 10) or LANG_ENGLISH; CHINESE = (SUBLANG_CHINESE_SIMPLIFIED shl 10) or LANG_CHINESE;
procedure TForm1.Exit1Click(Sender: TObject);begin Close;end;
procedure TForm1.Chese1Click(Sender: TObject);begin if LoadNewResourceModule(CHINESE) <> 0 then ReinitializeForms;end;
procedure TForm1.English1Click(Sender: TObject);begin if LoadNewResourceModule(ENGLISH) <> 0 then ReinitializeForms;end;
end.如果要自动切换语言 ,只要在 FormCreate 事件中添加如下代码即可 : if LoadNewResourceModule(SysLocale.DefaultLCID) <> 0 then ReinitializeForms;
我用了个 转换软件 把我DELPHI 的里所以代码和文字都转成繁体了 但是有个问题 就是 连接SQL出错 是知道 这个问题怎么解决 我就接分了