Delphi image intercept programming example (7)

xiaoxiao2021-03-06  112

(7) Caught the form or control picture form Create a new FORM2, saved as Capture2.PAS. Setting the four properties of the properties Bordericons Set to BSNONE.Borderstyle Set to FSSTAYONTOP. Two public variables: FRECT: TRECT, FBMP: TBITMAP;

Unit capture2;

Interface

Uses Windows, Messages, Sysutils, Variants, Classes, Graphics, Controls, Forms, Dialogs

type TForm2 = class (TForm) procedure FormCreate (Sender: TObject); procedure FormActivate (Sender: TObject); procedure FormDestroy (Sender: TObject); procedure FormPaint (Sender: TObject); procedure FormMouseUp (Sender: TObject; Button: TMouseButton; SHIFT: TSHIFTSTATE; X, Y: integer; private {private declarations} public FRECT: TRECT; FBMP: TBITMAP;

Var Form2: TFORM2;

IMPLEMentation

{$ R * .dfm}

// Create a new custom cursor Cursor_1, place in the Capture2.RES resource // file. Is 32 * 32 white rectangular border, used to indicate the range of the graph .Procedure TFORM2.FormCreate (Sender: TOBJECT); VAR ADC: hdc; const crhand = -18; begin screen.cursors [crhand]: = loading, 'cursor_1'; cursor: = cr Had; fbmp: = tbitmap.create; fbmp.width: = Screen.Width; FBMP Height: = screen.height; adc: = getdc (0); bitblt (fbmp.canvas.handle, 0,0, screen.width, screen.Height, ADC, 0, 0, srcopy); ReleaseDC (0, ADC) ); Setbounds (0, 0, screen.width, screen.height); end;

Procedure tForm2.formActivate (Sender: TOBJECT); const crhand = -18; begin screen.cursors [crhand]: = loadingcursor (Hinstance, Pchar ('Cursor_1')); CURSOR: = CrHand; End;

Procedure TFORM2.FORMDESTROY (Sender: TOBJECT); begin fbmp.free; screen.cursor: = crdefault;

Procedure TForm2.FormPaint (Sender: TOBJECT); Begin Canvas.draw (0, 0, FBMP); END;

Procedure TForm2.FormMouseup (Sender: Tobject; Button: TMouseButton; Shift: TshiftState; x, y: integer; begin modalResult: = mrok;

End.

转载请注明原文地址:https://www.9cbs.com/read-97517.html

New Post(0)