⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 t_file.pas

📁 Delphi图像盖章程序源码,供大家参考。
💻 PAS
📖 第 1 页 / 共 2 页
字号:
    book,book1:textfile;
    add:integer;
    you:boolean;
begin
add:=strtoint(G_read_indexINI(filename,'index',indexnum,0));
add:=add-1;
G_Write_IndexINI(filename,'index',indexnum+',',inttostr(add)+',',',',1);

try
you:=false;
assignfile(book,filename);
reset(book);
assignfile(book1,filename+'S');
rewrite(book1);
while not eof(book) do begin
   readln(book,str);
case li of
1:begin
if (copy(str,1,1) = '[') and (uppercase(Gshow_title(gshow_title(str,'[',4),']',3))<>uppercase('index'))
   then begin
            if strtoint(Gshow_title(gshow_title(str,'[',4),']',3)) = strtoint(Parent)
               then begin
                     repeat
                       readln(book,str);
                     until (copy(str,1,1) = '[') or ( eof(book));
                if eof(book) then break;
                     writeln(book1,'['+inttostr(strtoint(Gshow_title(gshow_title(str,'[',4),']',3))-1)+']');
                     you:=true;
                    end
               else if you = true
                      then writeln(book1,'['+inttostr(strtoint(Gshow_title(gshow_title(str,'[',4),']',3))-1)+']')
                      else writeln(book1,str);
        end
       else writeln(book1,str);
           end;//1
end;//case
                       end;
finally closefile(book);closefile(book1);end;

try
assignfile(book,filename+'s');
reset(book);
assignfile(book1,filename);
rewrite(book1);
while not eof(book) do begin
 readln(book,str);
 writeln(book1,str);
                       end;
finally closefile(book);closefile(book1);deletefile(filename+'s');end;
deletefile(filename+'s');
end;


procedure SpistoSpisII(filename,Newname,CaptionName,DrawName:string);
var book,book1:textfile;
    str,tmp:string;
    add:Integer;
begin
add:=0;tmp:='';
try
assignfile(book,filename);
reset(book);
readln(book,str);
readln(book,str);
   tmp:=str;
while not eof(book) do
   add:=add+1;
finally closefile(book);end;

G_write_indexINI(Newname,'index',
                 'name/num/id/',
                 CaptionName+'/1/SpisIIDraw/','/',3);
G_write_indexINI(Newname,'1',
                 'ImWidth/ImHeight/enname/num/',
                 Gshow_title(tmp,',',3)+'/'+
                 Gshow_title(tmp,',',4)+'/'+
                 DrawName+'/'+inttostr(add)+'/'
                 ,'/',4);

add:=1;
try
assignfile(book,filename);
reset(book);
assignfile(book1,Newname);
writeln(book1);
while not eof(book) do begin
   readln(book,str);
   writeln(book1,'ArrayPoint'+inttostr(add)+'='+str);
   add:=add+1;
                       end;
finally closefile(book);closefile(book1); end;

end;

function GFileClass(filename:string):integer;
var book:textfile;
    str:string;
begin
result:=0;
if trim(filename)<>''
   then begin
try
assignfile(book,filename);
reset(book);
readln(book,str);
if uppercase(str)=Uppercase('spisI bitmap')
   then result:=1;//试验五

if uppercase(str)=Uppercase('[index]')
   then begin
  if uppercase(G_read_indexINI(filename,'index','id',0)) = uppercase('SpisIIDraw')//SPISII的主绘图文件
        then result:=2;
  if uppercase(G_read_indexINI(filename,'index','id',0)) = uppercase('spisIIview')//SPISII的浏览文件
        then result:=3;
  if uppercase(G_read_indexINI(filename,'index','name',0)) = uppercase('SpisII')//SpisII的索引INI文件
        then result:=4;
  if uppercase(G_read_indexINI(filename,'index','name',0)) = uppercase('SpisIIview')//SpisII浏览的主索引INI文件
        then result:=5;
  if uppercase(G_read_indexINI(filename,'index','id',0)) = uppercase('SpisIIKey')//SPISII的键盘文件
        then result:=6;
  if uppercase(G_Read_IndexINI(filename,'index','name',0)) = uppercase('lpcII')//翻译系统标准格式
        then result:=7;
  if uppercase(G_Read_IndexINI(filename,'index','name',0)) = uppercase('lpcIII')//翻译系统mdi格式
        then result:=8;
  if uppercase(G_read_indexINI(filename,'index','id',0)) = uppercase('SpisIIHzFile')//SPISII的汉字文件
        then result:=9;
  if uppercase(G_read_indexINI(filename,'index','name',0)) = uppercase('TestMatter')//素质测试题目文件
        then result:=10;
  if uppercase(G_read_indexINI(filename,'index','name',0)) = uppercase('Station_busII')//线路设计  站文件
        then result:=11;
  if uppercase(G_read_indexINI(filename,'index','name',0)) = uppercase('layer_busII')//线路设计  层文件
        then result:=12;
  if uppercase(G_read_indexINI(filename,'index','name',0)) = uppercase('line_busII')//线路设计  线路文件
        then result:=13;
  if uppercase(G_read_indexINI(filename,'index','name',0)) = uppercase('workSpace_busII')//线路设计 工作区文件
        then result:=14;


  if uppercase(G_read_indexINI(filename,'index','name',0)) = uppercase('pho')//图形插入
        then result:=90;

        end;

finally closefile(book);end;
       end;
end;

procedure GDrawtoImage(filename:string;im:Timage;Mrect:TRect;drawli:string);
begin
case GFileClass(filename) of
9:begin

  end;
end;//case
end;


procedure GOpen_SpisIIView(im:Timage;filename:string;list:Tlistbox;li:integer;ProgressBar:TProgressBar;Pointlist:Tlistbox);
var i,j:integer;
    str:Ansistring;
begin
if list <> nil
   then case li of
        1:list.Items.clear;
        end;
Gcreatbmp(im,4,0,strtoint(Gshow_title(G_Read_IndexINI(filename,'index','imwh',0),',',3)),
                 strtoint(Gshow_title(G_Read_IndexINI(filename,'index','imwh',0),',',4)));

if ProgressBar <> nil then begin
ProgressBar.Max:=strtoint(G_Read_IndexINI(filename,'index','num',0));
ProgressBar.Position:=0;
ProgressBar.Visible:=true;

                           end;
for i:=1 to strtoint(G_Read_IndexINI(filename,'index','num',0)) do begin
   for j:=1 to strtoint(G_Read_IndexINI(filename,inttostr(i),'num',0)) do begin
      str:=(G_Read_IndexINI(filename,inttostr(i),'ArrayPoint'+inttostr(j),0));
if copy(str,0,1) <> '!'
  then begin
SPIStoCourse(str,im);
GDrawShape_(im,T_Course.DrawingTool,
T_Course.Gshow_title(T_Course.Gshow_title(str,':',4),'@',3)
,pmcopy);
if list <> nil
   then list.Items.Add(str);
if Pointlist <> nil then GgetPointArr(Gshow_title(T_Course.Gshow_title(str,':',4),'@',3),Pointlist);   
       end;
                                                                         end;
if ProgressBar <> nil then ProgressBar.Position:=i;
                                                                   end;
if ProgressBar <> nil then ProgressBar.Visible:=false;
end;

procedure GOpen_Spis(im:Timage;filename:string;list:Tlistbox;li:integer;ProgressBar:TProgressBar;Pointlist:Tlistbox);
var book:textfile;
    str:Ansistring;
    add:integer;
begin
add:=0;
if list <> nil
   then case li of
        1:list.Items.clear;
        end;
if FileExists(filename)
   then begin
try
if ProgressBar <> nil then begin
assignfile(book,filename);
reset(book);
while not eof(book) do begin
   readln(book,str);
   add:=add+1;
                       end;
closefile(book);

ProgressBar.Max:=add;
ProgressBar.Position:=0;
ProgressBar.Visible:=true;
                           end;//ProgressBar

assignfile(book,filename);
reset(book);
readln(book,str);
readln(book,str);
Gcreatbmp(im,4,0,strtoint(Gshow_title(str,',',3)),strtoint(Gshow_title(str,',',4)));
while not eof(book) do begin
  readln(book,str);
if copy(str,0,1) <> '!'
  then begin
SPIStoCourse(str,im);
GDrawShape_(im,T_Course.DrawingTool,
Gshow_title(T_Course.Gshow_title(str,':',4),'@',3)
,pmcopy);
if ProgressBar <> nil then ProgressBar.Position:=ProgressBar.Position+1;
if list <> nil
   then list.Items.Add(str);
if Pointlist <> nil
   then GgetPointArr(Gshow_title(T_Course.Gshow_title(str,':',4),'@',3),Pointlist);
       end;
                       end;
finally closefile(book);end;
if ProgressBar <> nil then ProgressBar.Visible:=false;
        end;//then
end;

procedure GOpen_SpisIIDraw(im:Timage;filename:string;list:Tlistbox;ProgressBar:TProgressBar;Pointlist:Tlistbox);
var i,j,add,M_W,M_H:integer;
    str:Ansistring;
begin
      M_W:=0;
      M_H:=0;
      for i:=1 to strtoint(G_Read_IndexINI(filename,'index','num',0)) do begin
      if (strtoint(G_Read_IndexINI(filename,inttostr(i),'ImWidth',0)) > M_w) or
         (strtoint(G_Read_IndexINI(filename,inttostr(i),'ImHeight',0)) > M_H)
         then begin
                M_W:=strtoint(G_Read_IndexINI(filename,inttostr(i),'ImWidth',0));
                M_H:=strtoint(G_Read_IndexINI(filename,inttostr(i),'ImHeight',0));
              end;
                                                                            end;
add:=application.MessageBox('是否按最大比例绘制全图'+#13+
                            '1.点击"是",按最大尺寸绘制'+#13+
                            '2.点击"否",按现有画布缩放绘制'+#13+
                            '3.点击"取消",','询问',mb_YESNOCANCEL);
if add = idyes
   then add:=100;
if add = idno
   then add:=200;
if add = idcancel
   then add:=300;
if ProgressBar<> nil then  begin
ProgressBar.Position:=0;
ProgressBar.Visible:=true;
                           end;
case add of
100:begin
if ProgressBar<> nil then ProgressBar.Max:=strtoint(G_Read_IndexINI(filename,'index','num',0));
GCreatbmp(im,4,0,M_W,M_H);
      for j:=1 to strtoint(G_Read_IndexINI(filename,'index','num',0)) do begin
        for i:=1 to strtoint(G_Read_IndexINI(filename,inttostr(j),'num',0)) do begin
  SPIStoCourse(G_Read_IndexINI(filename,inttostr(j),'ArrayPoint'+inttostr(i),0),im);
  GDrawShape_(im,T_Course.DrawingTool,
Gshow_title(Gshow_title(
G_Read_IndexINI(filename,inttostr(j),'ArrayPoint'+inttostr(i),0),':',4),'@',3)
,pmcopy);
if list<> nil then list.Items.add(G_Read_IndexINI(filename,inttostr(j),'ArrayPoint'+inttostr(i),0));
if Pointlist <> nil then GgetPointArr(Gshow_title(T_Course.Gshow_title(G_Read_IndexINI(filename,inttostr(j),'ArrayPoint'+inttostr(i),0),':',4),'@',3),Pointlist);
                                                                                  end;
if ProgressBar<> nil then ProgressBar.Position:=j;
                                                                            end;
      end;//1
200:begin
if ProgressBar<> nil then ProgressBar.Max:=strtoint(G_Read_IndexINI(filename,'index','num',0));
GCreatbmp(im,4,0,im.Width,im.Height);
      for j:=1 to strtoint(G_Read_IndexINI(filename,'index','num',0)) do begin
M_li:=GVex_li(point(im.Width,im.Height),
point(strtoint(G_Read_IndexINI(filename,inttostr(j),'ImWidth',0))
     ,strtoint(G_Read_IndexINI(filename,inttostr(j),'ImHeight',0))));

        for i:=1 to strtoint(G_Read_IndexINI(filename,inttostr(j),'num',0)) do begin
str:=G_Read_IndexINI(filename,inttostr(j),'ArrayPoint'+inttostr(i),0);

str:=GPointZoomOut(str,
inttostr(im.Width)+','+
inttostr(im.Height)+';'+
G_Read_IndexINI(filename,inttostr(j),'ImWidth',0)+','+
G_Read_IndexINI(filename,inttostr(j),'ImHeight',0)+';',
im,0);

  SPIStoCourse(str,im);
  GDrawShape_(im,T_Course.DrawingTool,Gshow_title(Gshow_title(str,':',4),'@',3),pmcopy);
if list<> nil then list.Items.add(str);
if Pointlist <> nil then GgetPointArr(Gshow_title(T_Course.Gshow_title(str,':',4),'@',3),Pointlist);                                                                                  end;
if ProgressBar<>nil then ProgressBar.Position:=j;
                                                                            end;

    end;
300:begin
    end;
end;//case
if ProgressBar<>nil then ProgressBar.Visible:=false;

end;

procedure GTxtFile_I(filename:string;Strdata:string;li:integer);
var book:textfile;
begin
try
assignfile(book,filename);
case li of
  1:rewrite(book);
  2:append(book);
end;
  writeln(book,Strdata);
finally closefile(book);end;
end;

function G_Filaname(exePath,filename:string;li:integer):string;
var tmp_1,tmp_2:string;
begin
tmp_1:=uppercase(GShow_title(exePath,'\',2));

if copy(filename,2,1) = ':'
   then tmp_2:=uppercase(copy(filename,0,length(tmp_1)))
   else tmp_2:=uppercase(filename);
   
case li of
1:begin//省略表示
if tmp_1 = tmp_2
   then result:='...\'+copy(filename,length(tmp_1)+2,length(filename))
   else result:=filename;
  end;
2:begin//恢复
if copy(filename,2,1) <> ':'
   then begin
          if copy(tmp_2,0,1) <> '\'
             then tmp_2:='\'+tmp_2;
result:=tmp_1+'\'+Gshow_title(tmp_2,'\',4);
        end
   else result:=filename;

  end;
3:begin
if tmp_1 = tmp_2
   then result:=copy(filename,length(tmp_1)+2,length(filename))
   else result:=filename;
  end;
4:begin
  end;
end;

end;
end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -