本帖最后由 lightdc4 于 2013-08-27 22:38:21 编辑

解决方案 »

  1.   

    方法1:调用时需要提供全路径。
    方法2:res资源文件放在你的项目文件相同的目录下面!
      

  2.   


    unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, cxLocalization, cxGraphics, cxControls, cxLookAndFeels,
      cxLookAndFeelPainters, cxStyles, cxCustomData, cxGridCustomView,
      cxGridChartView, cxClasses, cxGridLevel, cxGrid;type
      TForm1 = class(TForm)
        cxLocalizer1: TcxLocalizer;
        cxGrid1Level1: TcxGridLevel;
        cxGrid1: TcxGrid;
        cxGrid1ChartView1: TcxGridChartView;
        cxGrid1ChartView1Series1: TcxGridChartSeries;
        cxGrid1ChartView1DataGroup1: TcxGridChartDataGroup;
      private  protected
        procedure Loaded; override;
      public  end;var
      Form1: TForm1;implementation{$R *.dfm}
    {-------------------------------------------------------------------------------
      过程名:    TForm1.Loaded
      作者:      harlanchou
      日期:      2013.08.29
      说明:      cxLocalizer1放在这里比较合适,其它的地方无效
    -------------------------------------------------------------------------------}
    procedure TForm1.Loaded;
    begin
    //=========================================================
    // 方法一:使用ini文件来汉化
    //=========================================================
      cxLocalizer1.StorageType := lstIni;
      cxLocalizer1.FileName := 'C:\Program Files\Borland\Delphi7\Projects\test.ini';//=========================================================
    // 方法二:使用Res来汉化
    //=========================================================
      cxLocalizer1.StorageType := lstResource;  //加载Res有两种方法 方法一动态加态
      cxLocalizer1.FileName := 'C:\Program Files\Borland\Delphi7\Projects\test.res';
      //方法2 把res文件编译入程序{$R test.res}
      cxLocalizer1.LoadFromResource(HInstance);  //这里最好不要使用这个属性来设置语言种类
      //cxLocalizer1.Language := '中文(中国)';
      cxLocalizer1.Locale := 2052;
      cxLocalizer1.Active := True;
      inherited;
    end;end.