我的操作系統是繁体windows 2000高級服務器版,用Delphi 5/6+ sql server 7.0 開發程序,現在系統快開發完成,但在2000下顯示很好看的界面,到了繁体WIN98下就變了,界面顯得非常難看啊! 我在csdn的DELPHI板塊搜索了一下,結果說的都是簡体下的解決方案,繁体的怎樣處理,都沒有涉及到,請各位用繁体開發的大蝦能給我支個招啊,都快急瘋了,謝了先.

解决方案 »

  1.   

    将所有窗体chartset都设为defaultchartset试试看如何
      

  2.   

    参考一下这篇文章吧要为程序添加语言支持,只要在Delphi主菜单项Project下面选择Languages?Add…即可。点击之后出现语言向导,读者按照向导进行操作即可。向导结束之后,会生成一个工程组文件(BPG),最后出现Translation Manager,软件开发者可以在这里翻译所有语言的所有资源,包括字体、位置、文字等等。说明一下:你可以随时随地用Project下面的Languages子菜单的功能来添加、删除、修改各种界面元素。做完上述工作之后,我们现在就差切换语言的代码了。为了切换语言,大家可以使用下面的一个单元[],单元中提供了两个函数,用来更换语言界面元素,其中LoadNewResourceModule是用来修改文字信息等等,ReinitializeForms用来重新刷新窗体和控件以保证同步。///文件名:MaltiLan.pasunit MaltiLan;interfaceusesWindows, Messages, SysUtils, Classes, Graphics, Controls, Forms;procedure ReinitializeForms;function LoadNewResourceModule(Locale: LCID): Longint;implementationtypeTAsInheritedReader = class(TReader)Publicprocedure ReadPrefix(var Flags: TFilerFlags; var AChildPos: Integer); Override;end;procedure TAsInheritedReader.ReadPrefix(var Flags: TFilerFlags; var AChildPos: Integer);begininherited ReadPrefix(Flags, AChildPos);Include(Flags, ffInherited);end;function SetResourceHInstance(NewInstance: Longint): Longint;varCurModule: PLibModule;beginCurModule := LibModuleList;Result := 0;while CurModule <> nil dobeginif CurModule.Instance = HInstance thenbeginif CurModule.ResInstance <> CurModule.Instance thenFreeLibrary(CurModule.ResInstance);CurModule.ResInstance := NewInstance;Result := NewInstance;Exit;end;CurModule := CurModule.Next;end;end;function LoadNewResourceModule(Locale: LCID): Longint;varFileName: array[0..260] of char;P: PChar;LocaleName: array[0..4] of Char;NewInst: Longint;beginGetModuleFileName(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 thenbeginInc(P);if LocaleName[0] <> #0 thenbegin// Then look for a potential language/country translationlstrcpy(P, LocaleName);NewInst := LoadLibraryEx(FileName, 0, LOAD_LIBRARY_AS_DATAFILE);if NewInst = 0 thenbegin// Finally look for a language only translationLocaleName[2] := #0;lstrcpy(P, LocaleName);NewInst := LoadLibraryEx(FileName, 0, LOAD_LIBRARY_AS_DATAFILE);end;end;end;if NewInst <> 0 thenResult := SetResourceHInstance(NewInst)end;function InternalReloadComponentRes(const ResName: string; HInst: THandle; var Instance: TComponent): Boolean;varHRsrc: 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);tryAsInheritedReader := TAsInheritedReader.Create(ResStream, 4096);tryInstance := AsInheritedReader.ReadRootComponent(Instance);finallyAsInheritedReader.Free;end;finallyResStream.Free;end;Result := True;end;function ReloadInheritedComponent(Instance: TComponent; RootAncestor: TClass): Boolean;function InitComponent(ClassType: TClass): Boolean;beginResult := False;if (ClassType = TComponent) or (ClassType = RootAncestor) then Exit;Result := InitComponent(ClassType.ClassParent);Result := InternalReloadComponentRes(ClassType.ClassName, FindResourceHInstance(FindClassHInstance(ClassType)), Instance) or Result;end;beginResult := InitComponent(Instance.ClassType);end;procedure ReinitializeForms;varCount: Integer;I: Integer;Form: TForm;beginCount := Screen.FormCount;for I := 0 to Count - 1 dobeginForm := Screen.Forms[I];ReloadInheritedComponent(Form, TForm);end;end;end.测试程序窗体单元文件如下:///单元文件名:unit1.pasunit Unit1;interfaceusesWindows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,Menus, MLanTool, ExtCtrls, StdCtrls;typeTForm1 = 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;varForm1: TForm1;implementation{$R *.DFM}constENGLISH = (SUBLANG_ENGLISH_US shl 10) or LANG_ENGLISH;CHINESE = (SUBLANG_CHINESE_SIMPLIFIED shl 10) or LANG_CHINESE;procedure TForm1.Exit1Click(Sender: TObject);beginClose;end;procedure TForm1.Chese1Click(Sender: TObject);beginif LoadNewResourceModule(CHINESE) <> 0 thenReinitializeForms;end;procedure TForm1.English1Click(Sender: TObject);beginif LoadNewResourceModule(ENGLISH) <> 0 thenReinitializeForms;end;end.如果要自动切换语言,只要在FormCreate事件中添加如下代码即可:if LoadNewResourceModule(SysLocale.DefaultLCID) <> 0 thenReinitializeForms;说明一点:在程序完成的时候,你应该用Luanguages子菜单的Update Resources DLL功能更新所有的窗体和代码,然后用Build All Project编译所有的文件,这样才能保证你的程序正常运行
      

  3.   

    TO Dear mrfanghansheng,
     我打開Delphi 后,打開一個窗體,雙擊font屬性,在彈出的對話框中的右下角有一個字集下拉框,里面只有"CHINESE_BIG5"和"西歐"可選,沒有其他的,如你所說的"defaultchartset"啊!
      

  4.   

    楼主说的是窗口、控件的大小都变了吧!在开发时,所有新建的Form首先设置好字体Font->弹出Windows字体标准窗口->字体选择宋体(简体中文版)或细明体/新细明体(繁体中文版),字号选择9号,然后确认然后展开Font选项,设置Charset = DEFAULT_CHARSET不管你是在简体还是繁体、98还是20000/XP,每次在新建窗口时都应该这么设,一切就没有问题了
      

  5.   

    把字体设置成汉字,字符集用CHINESE_BIG5就可以了
      

  6.   

    謝謝大家的關心和幫助.我在win2000下開發,窗体字体就是設置的細明細体,不過設置的是10號字,到了98下運行就變了,特別是TDBEDIT和TButton,變的特別大,難看得要死.
      

  7.   

    看这一句:然后展开Form的Font选项,设置Charset = DEFAULT_CHARSET
      

  8.   

    我打開Delphi 后,打開一個窗體,雙擊font屬性,在彈出的對話框中的右下角有一個字集下拉框,里面只有"CHINESE_BIG5"和"西歐"可選,沒有DEFAULT_CHARSET這個選項可選擇啊!
      

  9.   

    所有控件
    Font->CharSet->CHINESE_BIG5
      

  10.   

    修改DEFAULT_CHARSET并不是在字体标准对话框中选择,而是:
    1、Font->弹出Windows字体标准窗口->字体选择宋体(简体中文版)或细明体/新细明体(繁体中文版),字号选择9号,然后确认2、然后展开然后展开Font选项(点Font前面的+号而不是Font后面的...按钮),设置Charset = DEFAULT_CHARSET
    这时是从下拉框中选择的,有很多种真不明白是说不清还是你不明白!
      

  11.   

    TO Dear Hank,
       万分感謝妳的回复!!我按照妳的方法試驗過了,成功了,但小弟一問,那就是
    我將繁体的窗口(字体為細明体,10號)通過"簡繁体轉換"的工具轉換為簡体(宋体)后,
    在簡体下去運行該程序,窗口會變的很難看嗎?如TDBEDIT和TButton,變的特別大等問題?
      

  12.   

    如果是开发阶段设置好不会存在你说的那种问题,但是问题出在这儿:
    1、繁体下你设置的是10号字,因为繁体Windows默认是9号字,当然实际应用时由于繁体笔画原因设置成10号,简体下开发都是9号字,在简体下看繁体的窗口是中的控件是有点大(例如TEdit的高度变大一个象素点),但你说的特别大是大多少?
    2、你是通过什么工具转换的?3、建议不要使用这种工具,而是通过资源文件控制的方式!这个我不说你也明白,很多简体和繁体的说法并不一样(打印机->印表机,服务器->伺服器....),通过简单的转换并不能解决问题!
      

  13.   

    TO Dear Hank,
    我是自己在网上下載的一個convert.exe的程序,可以簡繁体互換.pas,.dfm的文件.這個當然
    不能不能自動轉換簡繁体中的不同的說法了.但是通過資源文件控制的方式如何作,我還沒有
    試過.大蝦能否指點一二?或者提個思路或网址我去看看也可以.Thanks in advance.
      

  14.   

    1、关于资源文件去看看VC吧
    2、看看Delphi中resourcesing部分的说明
    3、到MSDN中察看*.RC文件(Delphi中编译后为*.Res文件)的说明
      

  15.   

    非常感謝Hank朋友的回复!
    再次感謝大家的回复!
    我的E_Mail:[email protected],愿大家共同進步!