麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 編程 > Delphi > 正文

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

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

(六)TMainForm的 (抓圖)Action 事件
1)全屏抓圖
[Capture Desktop]  Action 事件
PRocedure TMainForm.cptDesktopExecute(Sender: TObject);
begin
  inc(CaptureNum,1);
  application.Minimize ;  //窗體最小化
  Delay(500);             //最小化后延時,為了全屏抓圖不把自身抓進圖中
  FileName:='Capture'+IntToStr(CaptureNum)+'.bmp';
  FileName:=DefaultDirectory+FileName;
  CreateMDIChild(FileName,true);
  StatusBar.SimpleText := FileName;
  with ActiveMDIChild as TMDIChild do begin
    Image1.Picture.Bitmap := CaptureScreen;         //抓圖
    HorzScrollBar.Range := Image1.Picture.Width;
    VertScrollBar.Range := Image1.Picture.Height;
  end;
  Child.Image1.Hint := 'Height:'+intToStr(child.Image1.Picture.Height)+'pixels'
                     + ' Width:'+intToStr(child.Image1.Picture.Width)+'pixels';
  application.Restore ;
end;

2)區域抓圖
   抓取區域圖片,即要用到一個新的Form1,參見《Delphi圖象截取編程示例(6)》  .
   在Main單元implementation的uses中添加Capture1。
   在Main單元添加私有過程CaptureArea :

procedure TMainForm.CaptureArea;
begin
  with TForm1.Create(Application) do
  try
    if ShowModal=mrOK then
    with fRect do begin
      if (Right>Left)and(Bottom>Top) then begin
        Delay(400);
        ABitmap:=TBitmap.Create;
        ABitmap.Assign(CaptureScreenRect(fRect));
        Child.Image1.Picture.Bitmap:=ABitmap;
        Child.ClientWidth := Child.Image1.Picture.Width ;
        Child.ClientHeight:= Child.Image1.Picture.Height;
        Child.HorzScrollBar.Range:=Child.Image1.Picture.Width ;
        Child.VertScrollBar.Range:=Child.Image1.Picture.Height;
        ABitmap.Free ;
      end else begin
        MessageDlg('選擇圖片區域錯誤,請重新選擇!',mtInformation,[mbOK],0);
        Child.Close ;
        Form1.Free ;
        exit;
      end;
    end;
  finally
    Free;
  end;
end;

[Capture Area]區域抓圖的Action 事件
procedure TMainForm.cptAreaExecute(Sender: TObject);
begin
  Inc(CaptureNum,1);
  Application.Minimize ;
  Delay(500);
  FileName:='Capture'+IntToStr(CaptureNum)+'.bmp';
  FileName:=DefaultDirectory+FileName;
  { Create MDI Child Window }
  CreateMDIChild(FileName,true);
  StatusBar.SimpleText := FileName;

  { Capture Area of screen }
  CaptureArea;
  Child.Image1.Hint := 'Height:'+intToStr(child.Image1.Picture.Height)+'pixels'
                     + ' Width:'+intToStr(child.Image1.Picture.Width)+'pixels';
  application.Restore ;
end;


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

下一篇:Delphi圖象截取編程示例(3)

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

新聞熱點

疑難解答

圖片精選

網友關注

主站蜘蛛池模板: 国产妇女乱码一区二区三区 | 毛片中文字幕 | 91美女啪啪 | 日韩一级片一区二区三区 | 日本在线观看中文字幕 | 亚洲射情 | 一级黄色片武则天 | 九九精品在线播放 | 调教小男生抽打尿孔嗯啊视频 | 日本羞羞的午夜电视剧 | 黑人日比| 国产98色在线 | 国产精选91 | 亚洲福利在线视频 | 国产一区二区三区视频在线观看 | 免费看成人毛片 | 久久99久久98精品免观看软件 | 黄视频免费在线 | 蜜桃精品视频 | 毛片视频在线免费观看 | 国产乱乱视频 | 免费黄色大片网站 | 91精品国 | 九九精品在线播放 | 欧美性受ⅹ╳╳╳黑人a性爽 | 日韩精品a在线观看 | 亚洲天堂ww | 大片毛片 | 日本羞羞的午夜电视剧 | 成人一区二区三区在线 | 日韩美香港a一级毛片免费 欧美一级淫片007 | 午夜视频中文字幕 | 国产精品热 | 国产做爰| 黄色毛片免费视频 | 手机在线看片国产 | 国产毛片网站 | 久久免费综合视频 | 一级免费黄色免费片 | 一级毛片看 | 国产88久久久国产精品免费二区 |