尝试了多种方法,包括使用据说支持Unicode的TMS Unicode Component、SUIPack等,都不好使。最后还是用了简单的方法,在数据集组件的需要显示的字段的OnGetText事件,在事件处理中,对数据进行Unicode到GB的转换。
var SourceLength:integer;
DoneLength:integer;
AscNo:integer;
Byte1,Byte2,Byte3:integer;
begin
GbStr:='';
if Trim(unicodestr)='' then exit;
SourceLength:=Length(UnicodeStr);
DoneLength:=1;
repeat
AscNo:=ord(UnicodeStr[DoneLength]);
case (AscNo and $E0) of
$E0:begin
Byte1:=(AscNo and $0f) shl 12;
Inc(DoneLength);
if DoneLength>SourceLength then break;
AscNo:=ord(UnicodeStr[DoneLength]);
Byte2:=(AscNo and $3f) shl 6;
Inc(DoneLength);
if DoneLength>SourceLength then break;
AscNo:=ord(UnicodeStr[DoneLength]);
Byte3:=AscNo and $3f;
end;
$C0:begin
Byte1:=(AscNo and $1f) shl 6;
Inc(DoneLength);
if DoneLength>SourceLength then break;
AscNo:=ord(UnicodeStr[DoneLength]);
Byte2:=(AscNo and $3f);
Byte3:=0;
end;
0..$bf:begin
Byte1:=AscNo;
Byte2:=0;
Byte3:=0;
end;
end;//case;
GbStr:=GBStr+widechar(Byte1+Byte2+Byte3);
Inc(DoneLength);
if DoneLength>SourceLength then break;
until DoneLength>=SourceLength;
end;
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
var
attention : integer;
begin
attention := ARecord.Values[5];
if attention > 0 then
begin
AStyle := styleAttention;
exit;
end;
if ARecord.Values[4] = 0 then
begin
AStyle := styleRed;
end
else
begin
AStyle := styleDefault;
end;
end;
















