Delphi图象截取编程示例(1)

lavender筱

lavender筱

2016-02-19 14:16

有了下面这个Delphi图象截取编程示例(1)教程,不懂Delphi图象截取编程示例(1)的也能装懂了,赶紧get起来装逼一下吧!

  

  注意,本例在 Delphi7.0下调试通过
  ///////////////////////////////////////////////////////////

  (一)建立项目
    new Items--Projects--MDI Application
   
  (二)重新设计MDI子窗体--ChildWin,实现抓取的图象在ChildWin中显示。
  
    在ChildWin子窗体中去掉原有的Memo1控件,添加Image控件,Image1.Align=alClient。
      Image1.AutoSize=ture表示原尺寸显示,Strech=false表示不按对象框显示。

(本文来源于图老师网站,更多请访问https://m.tulaoshi.com/bianchengyuyan/)

  (三)主界面修改
    1)去掉 menu,toolbar,ActionList 中与 paste,new 相关的项
    2)添加 PrinterSetupDialog1,SaveDialog 控件到MainForm .
      添加菜单项file打印,属性name为filePrintItem;
      添加菜单项file打印设置,属性enabled=false,name为filePrintSet;
      添加菜单项editDraw ,它的属性enabled=false ;
      添加菜单项editPreferences,设置它为包含字菜单(create Submenu);
      添加菜单项editPreferencesConfiguration;
      添加菜单项editPreferencesToolBar,它的checked=true,name=toolbarItem;
      添加菜单Image;
      添加菜单项ImageCapture Desktop;
      添加菜单项ImageCapture Area;
      添加菜单项ImageCapture Windows or Controls;
      添加菜单项ImageCapture Icon
     
      添加四个toolbar button 到 toolbar,对应Image菜单下的四个菜单项。
     
      添加四个Action到ActionList:cptDestop,cptArea,cptWindows,cptIcon;
      将Image菜单下的四个菜单项 的action属性分别对应上面四个Action;
      将新增的四个toolbar button的action属性分别对应上面四个Action。
     
    3)在Main单元中把implementation的uses CHILDWIN移到interface的uses中,
      添加ScrnCpt到interface的uses中;
      在TMainForm的public中添加定义:
          Child: TMDIChild;
          CaptureNum:integer;
          FileName:String;
          DefaultDirectory:string;
         
    4)在TMainForm添加私有函数:procedure Delay(msecs:integer)
  procedure TMainForm.Delay(msecs:integer); //实现延时
  var FirstTickCount:Longint;
  begin
    FirstTickCount:=GetTickCount; //windows启动到现在的时间(豪秒)
    repeat
      begin
        Application.ProcessMessages; //中断程序让windows能响应发生的事件
      end;
    until ((GetTickCount-FirstTickCount)=Longint(msecs));
  end;

    5)修改[TMainForm.CreateMDIChild]过程:
      去掉变量var Child: TMDIChild,添加参数newFile
  procedure TMainForm.CreateMDIChild(const Name: string;newFile:boolean);
  begin
    Child := TMDIChild.Create(Application); { create a new MDI child window }
    Child.Caption := Name;
    if (not newFile)and(Name'') then begin
      Child.Image1.Picture.Bitmap.LoadFromFile(Name);
      Child.HorzScrollBar.Range := Child.Image1.Picture.Width;
      Child.VertScrollBar.Range := Child.Image1.Picture.Height;
    end;
  end;    
  

(本文来源于图老师网站,更多请访问https://m.tulaoshi.com/bianchengyuyan/)
展开更多 50%)
分享

猜你喜欢

Delphi图象截取编程示例(1)

编程语言 网络编程
Delphi图象截取编程示例(1)

Delphi图象截取编程示例(3)

编程语言 网络编程
Delphi图象截取编程示例(3)

s8lol主宰符文怎么配

英雄联盟 网络游戏
s8lol主宰符文怎么配

Delphi图象截取编程示例(7)

编程语言 网络编程
Delphi图象截取编程示例(7)

Delphi图象截取编程示例(2)

编程语言 网络编程
Delphi图象截取编程示例(2)

lol偷钱流符文搭配推荐

英雄联盟 网络游戏
lol偷钱流符文搭配推荐

Delphi图象截取编程示例(8)

编程语言 网络编程
Delphi图象截取编程示例(8)

Delphi图象截取编程示例(4)

编程语言 网络编程
Delphi图象截取编程示例(4)

lolAD刺客新符文搭配推荐

英雄联盟
lolAD刺客新符文搭配推荐

API解读:Thread

API解读:Thread

CSS如何控制网页(WEB)字体

CSS如何控制网页(WEB)字体
下拉加载更多内容 ↓