3) รวบรวมข้อมูลแบบฟอร์มหรือรูปภาพควบคุม
คว้าแบบฟอร์มหรือภาพควบคุมนั่นคือการใช้ Form2 ใหม่ดู "ตัวอย่างการเขียนโปรแกรม Delphi Image Intercept (7)"
เพิ่ม Capture2 ในการใช้งานหน่วยหลัก
[จับภาพ Windows หรือตัวควบคุม] เหตุการณ์การกระทำสำหรับแบบฟอร์มหรือการควบคุมการจับภาพ
ขั้นตอน tmainform.cptwindowsexecute (ผู้ส่ง: tobject);
Var P: THPOINT;
เริ่ม
Inc (Capturenum, 1);
Application.minimize;
ความล่าช้า (500);
ชื่อไฟล์: = 'Capture'+inttoStr (capturenum);
ชื่อไฟล์: = defaultDirectory+ชื่อไฟล์;
ด้วย tform2.create (แอปพลิเคชัน) ทำ
พยายาม
ถ้า showmodal = mrok แล้ว
เริ่ม
createemdichild (ชื่อไฟล์จริง);
StatusBar.SimpleText: = ชื่อไฟล์;
ความล่าช้า (500);
abitmap: = tbitmap.create;
GetCursorpos (P);
ที่จับ: = windowfrompoint (p);
abitmap: = capturewindowimage (มือจับ);
child.image1.picture.bitmap: = abitmap;
child.clientWidth: = child.image1.picture.width;
child.clientheight: = child.image1.picture.height;
เด็ก.
child.vertscrollbar.Range: = child.image1.picture.height;
child.image1.hint: = 'ความสูง:'+inttostr (child.image1.picture.height)+'พิกเซล'
+'ความกว้าง:'+inttoStr (child.image1.picture.width)+'พิกเซล';
abitmap.free;
จบ;
ในที่สุด
ฟรี;
Application.restore;
จบ;
จบ;
4) ภาพไอคอนรวบรวมข้อมูล
คว้ารูปภาพไอคอนนั่นคือการใช้ Form3 ใหม่ดู "ตัวอย่างการเขียนโปรแกรม Delphi Image Intercept (8)"
เพิ่ม Capture3 ในการใช้งานหน่วยหลัก
เพิ่มกระบวนการส่วนตัว captureicon ในหน่วยหลัก:
ขั้นตอน tmainform.captureicon;
เริ่ม
ด้วย tform3.create (แอปพลิเคชัน) ทำ
พยายาม
ถ้า showmodal = mrok แล้ว
ด้วย Frect จะเริ่มต้นขึ้น
ถ้า (ขวา> ซ้าย) และ (ด้านล่าง> ด้านบน) แล้วเริ่มต้น
ความล่าช้า (300);
abitmap: = tbitmap.create;
abitmap.assign (CapturesCreenRect (FRECT));
child.image1.picture.bitmap: = abitmap;
เด็ก.
child.vertscrollbar.Range: = child.image1.picture.height;
abitmap.free;
จุดเริ่มต้นเริ่มต้น
Messagedlg ('ข้อผิดพลาดในการเลือกชายแดนลองอีกครั้ง!', mtinformation, [mbok], 0);
child.close;
Form3.Free;
ออก;
จบ;
จบ;
ในที่สุด
ฟรี;
จบ;
จบ;
[Capture Icon] กิจกรรมการดำเนินการสำหรับไอคอนจับภาพรูปภาพ
ขั้นตอน tmainform.cpticonexecute (ผู้ส่ง: tobject);
เริ่ม
Application.minimize;
ความล่าช้า (400);
Inc (Capturenum, 1);
ชื่อไฟล์: = 'Capture'+inttoStr (capturenum);
ชื่อไฟล์: = defaultDirectory+ชื่อไฟล์;
createemdichild (ชื่อไฟล์จริง);
StatusBar.SimpleText: = ชื่อไฟล์;
Captureicon;
child.clientWidth: = child.image1.picture.width;
child.clientheight: = child.image1.picture.height;
เด็ก.
child.vertscrollbar.Range: = child.image1.picture.height;
child.image1.hint: = 'ความสูง:'+inttostr (child.image1.picture.height)+'พิกเซล'
+'ความกว้าง:'+inttoStr (child.image1.picture.width)+'พิกเซล';
Application.restore;
จบ;