前提

Windows98/Me 作業系統 是沒有內建支援Unicode,而在Windows 2000/XP/2003以後的版本是有支援UniCode

在Fast Report 3.15以前TfrxViewMemo是不支援UniCode所以 你在Memo的物件,如果要顯示繁體中文字體時,你的Font.Charset必須選定成ChineseBig5_CHARSET

(無須區分作業系統的版本)

在3.16的版本開始Memo支援UniCode

Windows98/Me 在TfrxViewMemo的Font.Charset還是要設定成ChineseBig5_CHARSET

反而 Windows 2000/XP/2003 的作業系統Run FastReport 3的報表內的TfrxViewMemo的Font.Charset設定成ChineseBig5的時候,繁體中文字卻不能完整顯示,而是要設定成 DEFAULT_CHARSET才是支援UniCode

那在Delphi要如何解決在使用FastReport 3.16之後版本中文字碼在不同作業系統上都可以正常顯示中文(如果要堅持使用3.15的版本,那~我認為你不是一各程式設計師)

procedure FSRP;

var j:integer;

begin

if WinExec('cmd.exe /c exit', SW_HIDE) < 31 then //判斷Windows版本
begin
for j := 0 to frxReport1.ComponentCount - 1 do //計算報表內共有幾個物件
begin
if frxReport1.Components[j].ClassName = 'TfrxMemoView' then //當物件名稱是Memo
begin
TfrxMemoView(frxReport1.Components[j]).Font.Charset := CHINESEBIG5_CHARSET; //變更Font.Charset為ChineseBig5_Charset
end;
end;
end;

end;

// if WinExec('cmd.exe /c exit', SW_HIDE) < 31 then
這是一各偷吃步,你要先在interface區 USES ShellAPI

在Windows98/Me沒有CMD這指令~但是在2000以後都有 來去判斷Windows的版本

在此前提,你需要把frxReport1內的TfrxViewMemo的Font.Charset設定是DEFAULT_CHARSET

也就是說,預設的執行環境Windows版本為Windows2000/XP以後有支援Unicode

當執行環境作業系統不支援Unicode的話,就把Charset換成ChineseBig5_Charset

引用 痣上無毛,辦事不牢
arrow
arrow
    全站熱搜

    giga0066 發表在 痞客邦 留言(0) 人氣()