(vi) tmainform의 (그림) 액션 이벤트
1) 전체 화면 캡처
[캡처 데스크탑] 액션 이벤트
절차 tmainform.cptdesktopexecute (발신자 : tobject);
시작하다
Inc (Capturenum, 1);
application.minimize; // 형식 최소화
지연 (500); // 최소 지연, 전체 화면에서 이미지를 캡처하려면 이미지에 자신을 잡지 마십시오.
filename : = 'capture'+inttostr (capturenum)+'. bmp';
filename : = DefaultDirectory+filename;
CreatemDichild (Filename, True);
statusbar.simpletext : = filename;
tmdichild로 ActiveMdichild를 사용하여 시작됩니다
image1.picture.bitmap : = 캡처 스크린;
horzscrollbar.range : = image1.picture.width;
vertscrollbar.range : = image1.picture.height;
끝;
child.image1.hint : = '높이 :'+inttostr (child.image1.picture.height)+'픽셀'
+'width :'+inttostr (child.image1.picture.width)+'픽셀';
application.restore;
끝;
2) 지역 캡처
영역 이미지를 캡처하려면 새로운 Form1이 사용하는 것이 "Delphi Image Intercept Programming Example (6)"을 참조하십시오.
주 단위 구현의 사용에 capture1을 추가하십시오.
Main Unit CaptureArea에서 개인 프로세스 추가 :
절차 tmainform.capturearea;
시작하다
tform1.create (응용 프로그램)를 사용하여
노력하다
showmodal = mrok라면
Frect가 시작됩니다
if (오른쪽> 왼쪽)과 (하단> 상단)를 시작합니다
지연 (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;
끝이 시작됩니다
MessagedLg ( '이미지 영역을 잘못 선택하면 재 선정!', mtinformation, [mbok], 0);
child.close;
form1. free;
출구;
끝;
끝;
마지막으로
무료;
끝;
끝;
[캡처 영역] 지역 캡처를위한 액션 이벤트
절차 tmainform.cptAreeExecute (sender : tobject);
시작하다
Inc (Capturenum, 1);
application.minimize;
지연 (500);
filename : = 'capture'+inttostr (capturenum)+'. bmp';
filename : = DefaultDirectory+filename;
{MDI Child Window 만들기}
CreatemDichild (Filename, True);
statusbar.simpletext : = filename;
{화면 캡처 영역}
Capturearea;
child.image1.hint : = '높이 :'+inttostr (child.image1.picture.height)+'픽셀'
+'width :'+inttostr (child.image1.picture.width)+'픽셀';
application.restore;
끝;