parent
7dc7a56308
commit
93c7cb4629
|
|
@ -0,0 +1,4 @@
|
|||
[ViewState]
|
||||
Mode=
|
||||
Vid=
|
||||
FolderType=Generic
|
||||
|
|
@ -2874,6 +2874,36 @@ A5183913CA16C9848495A52E9D4E97F11C21C73721A9904C28B506B19AD21D177
|
|||
);
|
||||
end
|
||||
end
|
||||
type tdwrapmemo= class(TDComponent)
|
||||
function HitTip();override;
|
||||
begin
|
||||
return inherited;
|
||||
end
|
||||
function bitmapinfo();override;
|
||||
begin
|
||||
return "0502000000060400000074797065000203000000696D670006040000006461746
|
||||
100025C01000089504E470D0A1A0A0000000D4948445200000018000000180806
|
||||
000000E0773DF8000000017352474200AECE1CE90000000467414D410000B18F0
|
||||
BFC6105000000097048597300000EC300000EC301C76FA864000000F149444154
|
||||
484BBD963B0E84300C44B9222D2DF474746968A938055C841370083A2A2A1AAFE
|
||||
C4D90133928F1C23E692407AC997C1444B1AE2B689542519625689502054CD324
|
||||
CE3026ECCF0E40243349E3385280F40EC5F102B07E429CFFAD406A8C29E50C5C2
|
||||
F056875879BC46BF7E00AB0E39F5996C5565F1E0D40F370CB866180AAAAA030C6
|
||||
408E429C390FC0674DD350081DB2641413879B87AAEB9A7ABC7B90CB799ED0F7F
|
||||
D658A3E287E1E5E8034E35008F6BBFA380EE8BA8E0224D401DC70DF7768DBD68E
|
||||
7C545B140620DBB6D9CAE79115DCA10A98E75917908A7A05A9A802A48F594CD95
|
||||
BA4550A2FFFB6007C0044475BEF4A7043C50000000049454E44AE42608200";
|
||||
end;
|
||||
function WndClass();override;
|
||||
begin
|
||||
return Class(twrapmemo);
|
||||
end
|
||||
function Create(AOwner);override;
|
||||
begin
|
||||
inherited;
|
||||
fiscontainerdcmp := false;
|
||||
end
|
||||
end
|
||||
type TDpassword= class(TDComponent)
|
||||
function HitTip();override;
|
||||
begin
|
||||
|
|
@ -3780,6 +3810,7 @@ begin
|
|||
class(TDEdit),
|
||||
class(TDpassword),
|
||||
class(TDmemo),
|
||||
class(tdwrapmemo),
|
||||
class(tdhighlighter),
|
||||
class(TDradiobtn),
|
||||
class(TDCheckBtn),
|
||||
|
|
|
|||
|
|
@ -1345,6 +1345,166 @@ type tmemo = class(TSynMemoNorm) //
|
|||
FonSetFocus;
|
||||
fonKillFocus;
|
||||
end
|
||||
type twrapmemo = class(TScrollingWinControl)
|
||||
public
|
||||
function create(aowner);
|
||||
begin
|
||||
ftexts := array();
|
||||
fcharcount := 10;
|
||||
ftext := "";
|
||||
inherited;
|
||||
AutoScroll := 1;
|
||||
end
|
||||
function doControlALign();override;
|
||||
begin
|
||||
formattexts();
|
||||
inherited;
|
||||
end
|
||||
function MouseDown(o,e);override;
|
||||
begin
|
||||
SetFocus();
|
||||
end
|
||||
function KeyDown(o,e);override; //按键处理
|
||||
begin
|
||||
if ssCtrl in e.shiftstate then
|
||||
begin
|
||||
case e.charcode of
|
||||
ord("C"):
|
||||
begin
|
||||
getclipboard().text := ftext;
|
||||
end
|
||||
end ;
|
||||
end
|
||||
end
|
||||
function paint();override;
|
||||
begin
|
||||
ypos := GetYPos();
|
||||
// 计算需要重绘的区域
|
||||
ps := PAINTSTRUCT().rcPaint;
|
||||
tp := ps[1];
|
||||
bo := ps[3];
|
||||
FirstLine := integer(max(0,yPos+(tp)/GetYScrollDelta()));
|
||||
LastLine := integer(min(length(ftexts)-1,yPos+(bo)/GetYScrollDelta()));
|
||||
rc := ps;
|
||||
cvs := Canvas;
|
||||
cvs.Font := font;
|
||||
for i:= FirstLine to LastLine do
|
||||
begin
|
||||
s := ftexts[i];
|
||||
r := RC;
|
||||
r[1]:= RC[1]+FCharHeight * (i-ypos);
|
||||
r[3]:= r[1]+FCharHeight;
|
||||
if ifstring(s) then
|
||||
begin
|
||||
cvs.drawtext(s,r);
|
||||
end
|
||||
end
|
||||
end
|
||||
function FontChanged(o);override;
|
||||
begin
|
||||
if HandleAllocated() then doControlALign();
|
||||
end
|
||||
protected
|
||||
function GetXScrollDelta();override; //x间隔
|
||||
begin
|
||||
return FCharwidth;
|
||||
end
|
||||
function GetYScrollDelta();override; //y 间隔
|
||||
begin
|
||||
return FCharHeight;
|
||||
end
|
||||
function GetClientXCapacity();override; //宽度容量
|
||||
begin
|
||||
return fcharcount+1;
|
||||
end
|
||||
function GetClientYCapacity();override; //高度容量
|
||||
begin
|
||||
r := ClientRect;
|
||||
return ceil((r[3]-r[1])/GetYScrollDelta());
|
||||
end
|
||||
function GetClientXCount();override; //宽度间隔
|
||||
begin
|
||||
return fcharcount;
|
||||
end
|
||||
function GetClientYCount();override; //高度项
|
||||
begin
|
||||
h := FCharHeight * length(ftexts);
|
||||
return integer(h/GetYScrollDelta());
|
||||
end
|
||||
function PositionChanged();override; //基准点改变
|
||||
begin
|
||||
InvalidateRect(nil,false);
|
||||
end
|
||||
published
|
||||
property text:text read ftext write settext;
|
||||
private
|
||||
function formattexts();
|
||||
begin
|
||||
FCharwidth := font.Width;
|
||||
FCharHeight := font.Height+4;
|
||||
ss := str2array(ftext,"\n");
|
||||
rec := ClientRect;
|
||||
fcharcount := integer((rec[2]-rec[0])/FCharwidth);
|
||||
ftexts := array();
|
||||
if fcharcount>0 then
|
||||
begin
|
||||
for i,v in ss do
|
||||
begin
|
||||
cutstr(v,fcharcount,ftexts);
|
||||
end
|
||||
end
|
||||
end
|
||||
function settext(s);
|
||||
begin
|
||||
if ifstring(s) and s<>ftext then
|
||||
begin
|
||||
ftext := s;
|
||||
if HandleAllocated() then
|
||||
begin
|
||||
doControlALign();
|
||||
InvalidateRect(nil,false);
|
||||
end
|
||||
end
|
||||
end
|
||||
function getclipboard();//获得clipbord
|
||||
begin
|
||||
if not FCopyer then
|
||||
begin
|
||||
FCopyer := new TcustomClipBoard(self);
|
||||
end
|
||||
return FCopyer;
|
||||
end
|
||||
function cutstr(s,w,r);
|
||||
begin
|
||||
idx := length(r);
|
||||
len := length(s);
|
||||
i := 0;
|
||||
while i<len do
|
||||
begin
|
||||
if i=len then break;
|
||||
et := min(i+w,len);
|
||||
if bytetype(s,et)=1 then
|
||||
begin
|
||||
et-=1;
|
||||
end
|
||||
r[idx++] := s[i+1:et];
|
||||
i := et;
|
||||
end
|
||||
return ;
|
||||
for i := 0 to len step w do
|
||||
begin
|
||||
if i=len then continue;
|
||||
r[idx++] := s[i+1:min(i+w,len)];
|
||||
end
|
||||
end
|
||||
private
|
||||
FCharwidth;
|
||||
fcharcount;
|
||||
FCharHeight;
|
||||
ftexts;
|
||||
ftext;
|
||||
[weakref] FCopyer;
|
||||
end
|
||||
type thighlighter= class(tcustomsynhighlighter) //语法高亮
|
||||
uses UTslMemo;
|
||||
function create(AOwner);
|
||||
|
|
|
|||
|
|
@ -504,7 +504,7 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
|||
FMouseIsDown;
|
||||
FInPutCache; //汉字输入缓存
|
||||
FSelectionMode; //选中模式
|
||||
FCopyer; //¼ôÇаå
|
||||
[weakref]FCopyer; //¼ôÇаå
|
||||
FReadOnly; //只读
|
||||
fUndoList; //撤销
|
||||
fRedoList; //反撤销
|
||||
|
|
@ -2340,9 +2340,10 @@ type TCustomMemo = class(TCustomScrollControl,TCustomMemoCmd) //
|
|||
end
|
||||
function GetMaxCharsInRow();
|
||||
begin
|
||||
if fMaxCharsInRow>10 then n := fMaxCharsInRow;
|
||||
else n := 10;
|
||||
return((FLines.RowMaxLength/n)+0.5)* n;
|
||||
if fMaxCharsInRow>5 then n := fMaxCharsInRow;
|
||||
else n := 5;
|
||||
//return((FLines.RowMaxLength/n)+0.5)* n;
|
||||
return(ceil((FLines.RowMaxLength+1)/n))* n;
|
||||
end
|
||||
function CreateCaret(); //构造光标
|
||||
begin
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ type TcustomClipBoard=class(tcomponent) //
|
|||
@explan(说明) 剪切板类 %%
|
||||
**}
|
||||
private
|
||||
private
|
||||
FIsopen;
|
||||
function CloseClipboard(); //关闭
|
||||
begin
|
||||
|
|
|
|||
Loading…
Reference in New Issue