界面库

编辑控件修正中文字符集问题
This commit is contained in:
JianjunLiu 2023-05-12 12:18:18 +08:00
parent 9203ab6a08
commit 3b568e2664
1 changed files with 58 additions and 1 deletions

View File

@ -887,6 +887,62 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
paintlinestext(RC,FirstLine,LastLine,FirstCol,LastCol);
end
function DrawLongString(cvs,dtx,tl,r,rnzf);
begin
if tl<1 then return ;
bt := 0;
ft := cvs.Font;
if rnzf>tl then
begin
qmzfs := 1;
ct := tl-1;
end else
begin
qmzfs := max(1,integer((0-r[0])/FCharWidth));
if qmzfs>3 and qmzfs<tl then
begin
if bytetype(dtx,qmzfs)=2 then qmzfs -= 1;
end
ct := min(tl-qmzfs+1,rnzf);
end
idx := qmzfs;
nqmzfs := qmzfs+ct;
qgqy := array((qmzfs,bt));
lqgqy := 1;
while idx<=(nqmzfs) do
begin
nbt := bytetype(dtx,i)?1:0;
if nbt<>bt then
begin
qgqy[lqgqy++] := array(idx,nbt);
bt := nbt;
end
idx++;
end
qgqy[lqgqy] := array(nqmzfs+1,bt);
bn := ft.charset ;
for i:= 0 to lqgqy-1 do
begin
ks := qgqy[i][0];
jz := qgqy[i+1][0];
ct := jz-ks;
if ct then
begin
r2 := r;
dtx2 := copy(dtx,ks,ct);
r2[0]+=(ks-1)* FCharWidth;
r2[2]:= r2[0]+ct * FCharWidth;
if qgqy[i][1] then
begin
ft.charset := 134;
end else
ft.charset := bn;
cvs.DrawText(dtx2,r2,DT_NOPREFIX);
end
end
ft.charset := bn;
end
{function DrawLongString2(cvs,dtx,tl,r,rnzf);
begin
bn := 100000;
ft := cvs.Font;
@ -928,7 +984,8 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
begin
ft.charset := bn;
end
end
end}
function paintlinestext(RC,FirstLine,LastLine,FirstCol,LastCol);virtual;
begin
cvs := canvas;