W
wanind
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.FormCreate(Sender: TObject);
begin
fscreen := tbitmap.Create; //创建一个bitmap来存放图像
fscreen.Height := screen.Height;
fscreen.Width := screen.Width;
dc := getdc(0); //取得屏幕的dc,参数0表示表示是屏幕
fscreencanvas := tcanvas.Create; //创建画布
fscreencanvas.Handle := dc;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
fscreen.Canvas.CopyRect(rect(0, 0, screen.Width div 2, screen.Height div 2), fscreencanvas, rect(0, 0, screen.Width div 2, screen.Height div 2));
fscreen.SaveToFile('d:/temp/test1.bmp');//抓取屏幕左上部分保存
fscreen.Canvas.CopyRect(rect(screen.Width div 2, 0, screen.Width, screen.Height div 2), fscreencanvas, rect(screen.Width div 2, 0, screen.Width, screen.Height div 2));
fscreen.SaveToFile('d:/temp/test2.bmp');//抓取屏幕右上部分保存
各位大侠看看这样写对不对。我是想实现分别抓取屏幕的左上和右上部分保存的,但是现在保存的左上部分的时候是对的,而保存的屏幕右上部分的图形确实把屏幕的整个上半部分抓取保存了,请问应该怎么解决。
begin
fscreen := tbitmap.Create; //创建一个bitmap来存放图像
fscreen.Height := screen.Height;
fscreen.Width := screen.Width;
dc := getdc(0); //取得屏幕的dc,参数0表示表示是屏幕
fscreencanvas := tcanvas.Create; //创建画布
fscreencanvas.Handle := dc;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
fscreen.Canvas.CopyRect(rect(0, 0, screen.Width div 2, screen.Height div 2), fscreencanvas, rect(0, 0, screen.Width div 2, screen.Height div 2));
fscreen.SaveToFile('d:/temp/test1.bmp');//抓取屏幕左上部分保存
fscreen.Canvas.CopyRect(rect(screen.Width div 2, 0, screen.Width, screen.Height div 2), fscreencanvas, rect(screen.Width div 2, 0, screen.Width, screen.Height div 2));
fscreen.SaveToFile('d:/temp/test2.bmp');//抓取屏幕右上部分保存
各位大侠看看这样写对不对。我是想实现分别抓取屏幕的左上和右上部分保存的,但是现在保存的左上部分的时候是对的,而保存的屏幕右上部分的图形确实把屏幕的整个上半部分抓取保存了,请问应该怎么解决。