国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Delphi > 正文

Delphi圖象截取編程示例(1)

2019-11-18 18:12:15
字體:
來源:轉載
供稿:網友

注意,本例在 Delphi7.0下調試通過
///////////////////////////////////////////////////////////

(一)建立項目
  new Items-->PRojects-->MDI application
 
(二)重新設計MDI子窗體--ChildWin,實現抓取的圖象在ChildWin中顯示。
    在ChildWin子窗體中去掉原有的Memo1控件,添加Image控件,Image1.Align=alClient。
    Image1.AutoSize=ture表示原尺寸顯示,Strech=false表示不按對象框顯示。

(三)主界面修改
  1)去掉 menu,toolbar,ActionList 中與 paste,new 相關的項
  2)添加 PrinterSetupDialog1,SaveDialog 控件到MainForm .
    添加菜單項file/打印,屬性name為filePrintItem;
    添加菜單項file/打印設置,屬性enabled=false,name為filePrintSet;
    添加菜單項edit/Draw ,它的屬性enabled=false ;
    添加菜單項edit/Preferences,設置它為包含字菜單(create Submenu);
    添加菜單項edit/Preferences/Configuration;
    添加菜單項edit/Preferences/ToolBar,它的checked=true,name=toolbarItem;
    添加菜單Image;
    添加菜單項Image/Capture Desktop;
    添加菜單項Image/Capture Area;
    添加菜單項Image/Capture Windows or Controls;
    添加菜單項Image/Capture 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;    


上一篇:Delphi圖象截取編程示例(2)

下一篇:Delphi中MIDAS如何控制前臺權限(MIDAS之六)

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
學習交流
熱門圖片

新聞熱點

疑難解答

圖片精選

網友關注

主站蜘蛛池模板: 浏阳市| 平安县| 民权县| 怀远县| 商城县| 麻栗坡县| 宝鸡市| 达拉特旗| 泸西县| 沙河市| 苍山县| 区。| 河曲县| 诸城市| 龙泉市| 高要市| 武邑县| 房产| 民丰县| 航空| 神农架林区| 呼图壁县| 札达县| 华安县| 武乡县| 苍山县| 郁南县| 肃宁县| 兴宁市| 东城区| 武乡县| 朝阳区| 松阳县| 定陶县| 郑州市| 仪陇县| 桐梓县| 衡山县| 永济市| 九江市| 精河县|