看看我写的这篇文章:
电影屏幕画面捕捉的实现
多媒体播放程序中大都有画面捕捉功能,利用Delphi的Copyrect函数同样可以实
现此功能。Copyrect函数的用法是:
procedure CopyRect(Dest: TRect;
Canvas: TCanvas;
Source: TRect);
下面为例子:
Unit Unit1;
Interface
Uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, MPlayer, StdCtrls;
Type
TForm1 = class(TForm)
MediaPlayer1: TMediaPlayer;
Image1: TImage;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
Implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
mediaplayer1.display:=form1;
mediaplayer1.DisplayRect:=rect(0,0,100,100);
//定义mediaplayer1的播放区域
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
image1.Canvas.CopyRect(image1.ClientRect,form1.canvas,rect(0,0,100,100));
//实现屏幕捕捉,将Form1上的图形拷贝到Image1的画布上
end;
end.