?? myedit.~pas
字號:
begin
if Ftxt[kk+j]>=#$20 then
begin
str1:=str1+chr(tpdata[kk+j].color);
k:=k-1;
end;
end;
kk:=kk+tpstr[i].linebyte;
i:=i+1;
for j:=1 to k do str1:=str1+#0;
end;
readcolor:=str1;
end;
procedure Tmyedit.insertpara(startpos,len,totallen,colorvalue,sizevalue,namevalue,stylevalue:longint);
var
i:longint;
begin
for i:=totallen downto startpos do
begin
tpdata[i+len]:=tpdata[i];
end;
for i:=startpos to startpos+len-1 do
begin
tpdata[i].color:=colorvalue;
tpdata[i].fontsize:=sizevalue;
tpdata[i].fontname:=namevalue;
tpdata[i].fontstyle:=stylevalue;
tpdata[i].extra:=0;
end;
end;
procedure Tmyedit.deletepara(startpos,len,totallen:longint);
var
i:longint;
begin
for i:=startpos to totallen-len do
begin
tpdata[i]:=tpdata[i+len];
end;
end;
procedure Tmyedit.movepara(startpos,len,endpos,fontcolor,fontsize,fontname,stylevalue:longint);
var
i,j,k,kcolor,ksize,kname,kstyle:longint;
begin
if startpos>endpos then
begin
k:=length(Ftxt);
for i:=0 to len-1 do
begin
if (startpos+i)<k then
begin
for j:=startpos-1+i downto i+endpos do
begin
tpdata[30000]:=tpdata[j];
// kcolor:=tpdata[j].color;
// kname:=tpdata[j].fontname;
// ksize:=tpdata[j].fontsize;
// kstyle:=tpdata[j].fontstyle;
tpdata[j]:=tpdata[j+1];
tpdata[j+1]:=tpdata[30000];
// tpdata[j+1].color:=kcolor;
// tpdata[j+1].fontname:=kname;
// tpdata[j+1].fontsize:=ksize;
// tpdata[j+1].fontsize:=kstyle;
end;
end;
end;
end
else if startpos<endpos then
begin
for i:=0 to len-1 do
begin
tpdata[30000]:=tpdata[startpos];
// kcolor:=tpdata[startpos].color;
// ksize:=tpdata[startpos].fontsize;
// kname:=tpdata[startpos].fontname;
// kstyle:=tpdata[startpos].fontstyle;
deletepara(startpos,1,endpos+len);
tpdata[endpos+len-1]:=tpdata[30000];
// tpdata[endpos+len-1].color:=kcolor;
// tpdata[endpos+len-1].fontsize:=ksize;
// tpdata[endpos+len-1].fontname:=kname;
// tpdata[endpos+len-1].fontname:=kstyle;
end;
end
else
begin
for i:=0 to len-1 do
begin
tpdata[startpos+i].color:=fontcolor;
tpdata[startpos+i].fontname:=fontname;
tpdata[startpos+i].fontsize:=fontsize;
tpdata[startpos+i].fontstyle:=stylevalue;
tpdata[i].extra:=0;
end;
end;
end;
procedure Tmyedit.changepara(startpos,selectlen,klen,k,fontcolor,fontsize,fontname,stylevalue:longint);
begin
if (selectlen<>0) then
begin
deletepara(startpos,selectlen,k);
if klen<>k-selectlen then
insertpara(startpos,klen-k+selectlen,k-selectlen,fontcolor,fontsize,fontname,stylevalue);
end
else
begin
if klen>k then
begin
insertpara(startpos,klen-k,k,fontcolor,fontsize,fontname,stylevalue);
end
else if k>klen then
begin
deletepara(startpos,k-klen,k);
end;
end;
end;
procedure Tmyedit.addstyle(startpos,endpos,value:integer);
var
i:longint;
begin
for i:=startpos to endpos do
begin
tpdata[i].fontstyle:=tpdata[i].fontstyle or value;
end;
end;
procedure Tmyedit.changestyle(startpos,endpos,value:integer);
var
i:longint;
begin
for i:=startpos to endpos do
begin
tpdata[i].fontstyle:=value;
end;
end;
procedure Tmyedit.subbstyle(startpos,endpos,value:integer);
var
i:longint;
begin
for i:=startpos to endpos do
begin
tpdata[i].fontstyle:=tpdata[i].fontstyle and value
end;
end;
procedure Tmyedit.changeextra(startpos,endpos,value:integer);
var
i:longint;
begin
for i:=startpos to endpos do
begin
tpdata[i].extra:=value;
end;
end;
procedure Tmyedit.readselectdot(Index: Integer);
begin
selectdotx[1]:=aleft;
selectdotx[7]:=selectdotx[1];
selectdotx[8]:=selectdotx[1];
selectdoty[1]:=atop;
selectdoty[2]:=selectdoty[1];
selectdoty[3]:=selectdoty[1];
selectdotx[3]:=selectdotx[1]+awidth-5;
selectdotx[4]:=selectdotx[3];
selectdotx[5]:=selectdotx[3];
selectdotx[2]:=(selectdotx[1]+selectdotx[3]+5) div 2-5;
selectdotx[6]:=selectdotx[2];
selectdoty[5]:=selectdoty[1]+aheight-5;
selectdoty[6]:=selectdoty[5];
selectdoty[7]:=selectdoty[5];
selectdoty[4]:=(selectdoty[1]+selectdoty[5]+5) div 2-5;
selectdoty[8]:=selectdoty[4];
end;
procedure Tmyedit.WMLButtonDown(var msg: TWMLButtonDown);
var
i:integer;
begin
if (visible) and (Fplay=false) and (not (csDesigning in ComponentState)) then
begin
Fselectbmpno:=-1;
if Faddflag=true then
begin
pushed:=true;
pmouseposx:=msg.Xpos;
pmouseposy:=msg.Ypos;
startposx:=msg.Xpos;
startposy:=msg.Ypos;
canvas.DrawFocusRect(rect(startposx,startposy,pmouseposx,pmouseposy));
end
else
begin
for i:=getimagecount-1 downto 0 do
begin
readdata(i);
if dotinrect(msg.Xpos,msg.Ypos,aleft,atop,aWidth,aHeight) then
begin
selectdispno:=dispno;
pmouseposx:=msg.Xpos;
pmouseposy:=msg.Ypos;
Fselectbmpno:=i;
paint;
selseccursor(msg.Xpos,msg.Ypos);
inherited;
exit;
end;
end;
paint;
end;
end;
inherited;
end;
procedure Tmyedit.readdata(Index: Integer);
var
i:integer;
str:string;
begin
str:=Getimage(Index);
val(str,dispno,i);
delete(str,1,i);
val(str,aleft,i);
if (str<>'') and (str[1]='-') then aleft:=-1*aleft;
delete(str,1,i);
val(str,atop,i);
if (str<>'') and (str[1]='-') then atop:=-1*atop;
delete(str,1,i);
val(str,awidth,i);
delete(str,1,i);
val(str,aheight,i);
atop:=atop+(dispno-Ftpcount+1)*height;
end;
procedure Tmyedit.WMMouseMove(var msg: TWMMouseMove);
var
x,y,x1,y1:integer;
begin
if (msg.Xpos=pmouseposx) and (msg.Ypos=pmouseposy) then exit;
if (pushed=true) then
begin
if Faddflag=true then
begin
canvas.DrawFocusRect(rect(startposx,startposy,pmouseposx,pmouseposy));
canvas.DrawFocusRect(rect(startposx,startposy,msg.xpos,msg.ypos));
pmouseposx:=msg.Xpos;
pmouseposy:=msg.Ypos;
end
else if (Fselectbmpno>=0) then
begin
x:=strtoint(GetCells(1,Fselectbmpno));
y:=strtoint(GetCells(2,Fselectbmpno));
x1:=strtoint(GetCells(3,Fselectbmpno));
y1:=strtoint(GetCells(4,Fselectbmpno));
if (selectdot=0) then
begin
x:=x+msg.Xpos-pmouseposx;
y:=y+msg.ypos-pmouseposy;
end
else if (selectdot=1) then
begin
x:=x+msg.Xpos-pmouseposx;
y:=y+msg.ypos-pmouseposy;
x1:=x1-msg.Xpos+pmouseposx;
y1:=y1-msg.ypos+pmouseposy;
end
else if (selectdot=2) then
begin
y:=y+msg.ypos-pmouseposy;
y1:=y1-msg.ypos+pmouseposy;
end
else if (selectdot=3) then
begin
y:=y+msg.ypos-pmouseposy;
x1:=x1+msg.Xpos-pmouseposx;
y1:=y1-msg.ypos+pmouseposy;
end
else if (selectdot=4) then
begin
x1:=x1+msg.Xpos-pmouseposx;
end
else if (selectdot=5) then
begin
x1:=x1+msg.Xpos-pmouseposx;
y1:=y1+msg.ypos-pmouseposy;
end
else if (selectdot=6) then
begin
y1:=y1+msg.Ypos-pmouseposy;
end
else if (selectdot=7) then
begin
x:=x+msg.Xpos-pmouseposx;
x1:=x1-msg.Xpos+pmouseposx;
y1:=y1+msg.ypos-pmouseposy;
end
else if (selectdot=8) then
begin
x:=x+msg.Xpos-pmouseposx;
x1:=x1-msg.Xpos+pmouseposx;
end;
if x1<1 then x1:=1;
if y1<1 then y1:=1;
// if x+x1<1 then x:=-x1+1;
// if y+y1<1 then y:=-y1+1;
if x>=width then x:=width-2;
// if y>=height then y:=height-2;
if y+selectdispno*height<0 then y:=-selectdispno*height;
if y>(tptotal-selectdispno)*height-2 then y:=(tptotal-selectdispno)*height-2;
SetCells(1, Fselectbmpno,inttostr(x));
SetCells(2, Fselectbmpno,inttostr(y));
SetCells(3, Fselectbmpno,inttostr(x1));
SetCells(4, Fselectbmpno,inttostr(y1));
pmouseposx:=msg.Xpos;
pmouseposy:=msg.Ypos;
paint;
end;
end
else selseccursor(msg.Xpos,msg.Ypos);
inherited;
end;
procedure Tmyedit.selseccursor(x,y:integer);
var
i:integer;
begin
if (Fselectbmpno>=0) then
begin
cursor:=crDefault;
selectdot:=0;
for i:=1 to 8 do
begin
if dotinrect(x,y,selectdotx
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -