📄 exe.pas
字号:
BlinkImage.Width:=ShowArray[i].Blink.Width;
BlinkImage.Height:=ShowArray[i].Blink.Height;
{------------------------------------------------------}
BlinkLeftEdit.Text:=IntToStr(ShowArray[i].Blink.Left);
BlinkTopEdit.Text:=IntToStr(ShowArray[i].Blink.Top);
BlinkWidthEdit.Text:=IntToStr(ShowArray[i].Blink.Width);
BlinkHeightEdit.Text:=IntToStr(ShowArray[i].Blink.Height);
end
else BlinkCheckBox.Checked:=False;
{Wav}
if FileExists(MainForm.MainDir+MainForm.WavDir+ShowArray[i].WavFileName) then
begin
WavCheckBox.Checked:=True;
WavMediaPlayer.FileName:=(MainForm.MainDir+MainForm.wavdir+ShowArray[i].WavFileName);
WavMediaPlayer.Open;
WavMediaPlayer.Rewind;
WavMediaPlayer.Play;
WavEdit.Text:=ShowArray[i].WavFileName;
end
else
begin
WavCheckBox.Checked:=False;
WavEdit.Text:='';
end;
end;
{WorkMemo从ExeMemo读入数据}
function TExeForm.WorkMemoGetDataFromExeMemo(const CompareStr:String;const DirectMemo,SourceMemo:TMemo):Integer;
var
i,StartNum,MemoLinesCount:Integer;
EndFlag:Boolean;
begin
StartNum:=0;
Result:=0;
MemoLinesCount:=SourceMemo.Lines.Count;
i:=0;
{查找数据位置}
while i<MemoLinesCount-1 do
begin
if Pos(CompareStr+'~',SourceMemo.Lines[i])<>0 then
begin
StartNum:=i;
Result:=i;
i:=MemoLinesCount;
end
else Inc(i);
end;
{取数据}
if i<>MemoLinesCount-1 then
begin
Inc(StartNum);
EndFlag:=False;
while (Not EndFlag) and (StartNum<MemoLinesCount) do
begin
if Pos('^',SourceMemo.Lines[StartNum])=0 then
begin
DirectMemo.Lines.Add(SourceMemo.Lines[StartNum]);
Inc(StartNum);
end
else EndFlag:=True;
end;
end;
end;
{初始化数据}
procedure TExeForm.InitShowArray;
var
i:Integer;
begin
for i:=0 to MaxShowArrayNum do
begin
ShowArray[i].Bmp.TitleName:='';
ShowArray[i].Bmp.FileName:='';
ShowArray[i].Bmp.SmallFileName:='';
ShowArray[i].Avi.FileName:='';
ShowArray[i].Avi.Top:=0;
ShowArray[i].Avi.Left:=0;
ShowArray[i].Avi.Width:=0;
ShowArray[i].Avi.Height:=0;
ShowArray[i].Txt.FileName:='';
ShowArray[i].Txt.Top:=0;
ShowArray[i].Txt.Left:=0;
ShowArray[i].Txt.Width:=0;
ShowArray[i].Txt.Height:=0;
ShowArray[i].Blink.Blink:='';
ShowArray[i].Blink.Top:=0;
ShowArray[i].Blink.Left:=0;
ShowArray[i].Blink.Width:=0;
ShowArray[i].Blink.Height:=0;
ShowArray[i].WavFileName:='';
end;
end;
//数据行翻译
procedure TExeForm.TranslateStr;
var
i,j,k,m,StrLength,Num,StrPos:Integer;
NumArray:Array[0..6] of Integer;
StrArray:Array[0..6] of string[80];
Str:Array[0..6] of string[80];
begin
{初始化数组}
for i:=0 to 6 do
begin
NumArray[i]:=0;
Str[i]:='';
StrArray[i]:='';
end;
{分离一行代码}
i:=0;
while i<=WorkMemo.Lines.Count-1 do
begin
j:=0;
Num:=0;
StrLength:=Length(WorkMemo.Lines[i]);
while j<=Strlength do{得到';'的位置}
begin
if Copy(WorkMemo.Lines[i],j,1)=';' then
begin
NumArray[1+Num]:=j;
if Num=0 then
Str[Num]:=Copy(WorkMemo.Lines[i],NumArray[Num],NumArray[1+Num]-NumArray[Num]-1)
else
Str[Num]:=Copy(WorkMemo.Lines[i],NumArray[Num]+1,NumArray[1+Num]-NumArray[Num]-1);
{分离功能数据}
k:=1;
StrPos:=0;
while k<=Length(Str[Num]) do
begin
if Str[Num][k]<>',' then
StrArray[StrPos]:=StrArray[StrPos]+Str[Num][k]
else
begin
Inc(StrPos);
end;
inc(k);
end;
{具体某一功能的数据}
case StrToInt(StrArray[0]) of
0:{is bmp}
begin
ShowArray[i].Bmp.TitleName:=StrArray[1];
ShowArray[i].Bmp.FileName:=StrArray[2];
ShowArray[i].Bmp.SmallFileName:=StrArray[3];
end;
1:{is Avi}
begin
ShowArray[i].Avi.FileName:=StrArray[1];
ShowArray[i].Avi.Left:=MyStrToInt(StrArray[2]);
ShowArray[i].Avi.Top:=MyStrToInt(StrArray[3]);
ShowArray[i].Avi.Width:=MyStrToInt(StrArray[4]);
ShowArray[i].Avi.Height:=MyStrToInt(StrArray[5]);
end;
2:{Is txtfile}
begin
ShowArray[i].Txt.FileName:=StrArray[1];
ShowArray[i].Txt.Left:=MyStrToInt(StrArray[2]);
ShowArray[i].Txt.Top:=MyStrToInt(StrArray[3]);
ShowArray[i].Txt.Width:=MyStrToInt(StrArray[4]);
ShowArray[i].Txt.Height:=MyStrToInt(StrArray[5]);
end;
3:{is Blink}
begin
ShowArray[i].Blink.BLink:=StrArray[1];
ShowArray[i].Blink.Left:=MyStrToInt(StrArray[2]);
ShowArray[i].Blink.Top:=MyStrToInt(StrArray[3]);
ShowArray[i].Blink.Width:=MyStrToInt(StrArray[4]);
ShowArray[i].Blink.Height:=MyStrToInt(StrArray[5]);
end;
4:{is Wav}
begin
ShowArray[i].WavFileName:=StrArray[1];
end;
end;
{clear StrArray[i]}
for m:=0 to 6 do
begin
StrArray[m]:='';
end;
{Deal next}
Inc(Num);
end;
Inc(j);
end;
Inc(i);
end;
end;
{代换背景}
procedure TExeForm.copyback;
var
arect:trect;
begin
arect:=rect(0,0,BackImage.Width,BackImage.Height);
with Bmpimage.canvas do
begin
copymode:=cmsrccopy;
copyrect(arect,BackImage.canvas,arect);
end;
end;
//选图形页
procedure TExeForm.BMPMenuItemClick(Sender: TObject);
begin
TabbedNotebook1.ActivePage:='图形';
end;
//动画页
procedure TExeForm.AviMenuItemClick(Sender: TObject);
begin
TabbedNotebook1.ActivePage:='动画';
CopyBack;
HotArea.x0:=AviPanel.Left;
HotArea.y0:=AviPanel.Top;
HotArea.x1:=AviPanel.Left+AviPanel.Width;
HotArea.y1:=AviPanel.Top+AviPanel.Height;
DrawRect(HotArea.x0,HotArea.y0,HotArea.x1,HotArea.y1,BmpImage.canvas);
DrawLittleRect(HotArea.x0,HotArea.y0,HotArea.x1,HotArea.y1,BmpImage.canvas);
HotObjectNum:=0;
AviPanel.Visible:=True;
end;
//文字说明页
procedure TExeForm.TxtMenuItemClick(Sender: TObject);
begin
TabbedNotebook1.ActivePage:='文本';
CopyBack;
HotArea.x0:=TxtMemo.Left;
HotArea.y0:=TxtMemo.Top;
HotArea.x1:=TxtMemo.Left+TxtMemo.Width;
HotArea.y1:=TxtMemo.Top+TxtMemo.Height;
DrawRect(HotArea.x0,HotArea.y0,HotArea.x1,HotArea.y1,BmpImage.canvas);
DrawLittleRect(HotArea.x0,HotArea.y0,HotArea.x1,HotArea.y1,BmpImage.canvas);
HotObjectNum:=1;
TxtMemo.Visible:=True;
end;
{装入BMP文件}
procedure TExeForm.BmpFileEditClick(Sender: TObject);
var
StrLength1,StrLength2:Integer;
begin
OpenDialog1.InitialDir:=MainForm.MainDir+MainForm.BmpDir;
OpenDialog1.DefaultExt:='*.Bmp';
OpenDialog1.Filter:='Bmp files (*.bmp)|*.bmp';
if OpenDialog1.Execute then
begin
StrLength1:=Length(MainForm.MainDir+MainForm.BmpDir);
StrLength2:=Length(OpenDialog1.FileName);
BmpFileEdit.Text:=(Copy(OpenDialog1.FileName,StrLength1+1,StrLength2-StrLength1+1));
BmpImage.Picture.LoadFromFile(OpenDialog1.FileName);
BackImage.Picture.LoadFromFile(OpenDialog1.FileName);
BmpImage.Visible:=True;
BackImage.Visible:=True;
end;
end;
{装入TXT}
procedure TExeForm.TxtFileEditClick(Sender: TObject);
var
StrLength1,StrLength2:Integer;
begin
OpenDialog1.InitialDir:=MainForm.MainDir+MainForm.TxtDir;
OpenDialog1.DefaultExt:='*.txt';
OpenDialog1.Filter:='Txt files (*.txt)|*.txt';
if OpenDialog1.Execute then
begin
TxtMemo.Lines.LoadFromFile(OpenDialog1.FileName);
StrLength1:=Length(MainForm.MainDir+MainForm.TxtDir);
StrLength2:=Length(OpenDialog1.FileName);
TxtFileEdit.Text:=(Copy(OpenDialog1.FileName,StrLength1+1,StrLength2-StrLength1+1));
TxtLeftEdit.Text:=IntToStr(TxtMemo.Left);
TxtTopEdit.Text:=IntToStr(TxtMemo.Top);
TxtWidthEdit.Text:=IntToStr(TxtMemo.Width);
TxtHeightEdit.Text:=IntToStr(TxtMemo.Height);
TxtMemo.Visible:=True;
end;
end;
{装入Avi}
procedure TExeForm.AviFileEditClick(Sender: TObject);
var
StrLength1,StrLength2:Integer;
begin
OpenDialog1.InitialDir:=MainForm.MainDir+MainForm.AviDir;
OpenDialog1.DefaultExt:='*.Avi';
OpenDialog1.Filter:='Avi files (*.avi)|*.avi';
if OpenDialog1.Execute then
begin
AviMediaPlayer.FileName:=OpenDialog1.FileName;
StrLength1:=Length(MainForm.MainDir+MainForm.AviDir);
StrLength2:=Length(OpenDialog1.FileName);
AviFileEdit.Text:=(Copy(OpenDialog1.FileName,StrLength1+1,StrLength2-StrLength1+1));
CopyBack;
AviMediaPlayer.Enabled:=True;
AviMediaPlayer.AutoOpen:=True;
AviMediaPlayer.Open;
AviPanel.Width:=AviMediaPlayer.DisplayRect.Right;
AviPanel.Height:=AviMediaPlayer.DisplayRect.Bottom;
AviLeftEdit.Text:=IntToStr(AviPanel.Left);
AviTopEdit.Text:=IntToStr(AviPanel.Top);
AviWidthEdit.Text:=IntToStr(AviPanel.Width);
AviHeightEdit.Text:=IntToStr(AviPanel.Height);
AviMediaPlayer.Play;
AviMediaPlayer.Visible:=True;
AviPanel.Visible:=True;
end;
end;
{返回前保存文件}
procedure TExeForm.ReturnButtonClick(Sender: TObject);
begin
ExeMemo.Lines.SaveToFile(MainForm.AutoTxtFileName);
WavMediaPlayer.Close;
Close;
end;
//窗体创建时,初始化数据
procedure TExeForm.FormCreate(Sender: TObject);
begin
HotArea.x0:=100;
HotArea.y0:=100;
HotArea.x1:=200;
HotArea.y1:=200;
HotDragAreaNum:=0;
HotObjectNum:=-1;{0 is Avi,1 is Txt}
SaveExeInSertLineNum:=0;
ShowArrayTotalNum:=0;
NotMoveFlag:=False;
StepComBoBox.Font.Color:=clBlue;
end;
{鼠标按下}
procedure TExeForm.BmpImageMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Mousepointinrect(X,Y,HotArea.x0,HotArea.y0,HotArea.x1,HotArea.y1) then
begin
if (Button=mbLeft) then
begin
CopyBack;
HotDragAreaNum:=Mousepointinwhichrect(X,Y,HotArea.x0,HotArea.y0,HotArea.x1,HotArea.y1);
AllowMoveFlag:=True;
LastX:=X;
LastY:=Y;
case HotObjectNum of
0: AviPanel.Visible:=True;
1: TxtMemo.Visible:=True;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -