(7) 아이콘의 형태 (아이콘)를 기어 다닙니다.
새 Form3를 작성하고 capture3.pas로 저장하십시오. 속성 국경의 4 가지 속성을 거짓으로 설정하십시오.
Borderstyle은 BSNONE으로 설정되며 FormStyle은 FsstayOntop으로 설정됩니다.
하나의 개인 변수 : fdragging : 부울;
단위 캡처 3;
인터페이스
용도
창, 메시지, 시스템, 변형, 클래스, 그래픽, 컨트롤, 양식,
대화;
유형
tform3 = 클래스 (tform)
프로 시저 Formcreate (sender : tobject);
절차 formmousedown (sender : tobject; button : tmousebutton;
Shift : TshiftState; X, Y : Integer);
프로 시저 FormmousEmove (Sender : Tobject; Shift : TshiftState;
x, y : 정수);
프로 시저 FormMouseUp (sender : tobject; 버튼 : tmouseButton;
Shift : TshiftState; X, Y : Integer);
절차 formactivate (sender : tobject);
절차 formdestroy (sender : tobject);
절차 formpaint (발신자 : Tobject);
사적인
fdragging : 부울;
공공의
frect : trect;
FBMP : TBITMAP;
끝;
var
form3 : tform3;
구현
{$ r *.dfm}
// 새 사용자 정의 커서 Cursor_2를 만들고 capture3.res resource에 배치합니다.
// 파일에는 캡처 범위를 나타내는 흰색 직사각형 테두리 32*32가 있습니다.
절차 tform3.formcreate (sender : tobject);
VAR ADC : HDC;
const crbox = -19;
시작하다
screen.cursors [crox] : = loadcursor (Hinstance, 'cursor_2');
커서 : = CRBOX;
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, srccopy);
릴리스 C (0, ADC);
setBounds (0,0, screen.width, screen.height);
끝;
절차 tform3.formmousedown (발신자 : Tobject; 버튼 : TmouseButton;
Shift : TshiftState; X, Y : Integer);
시작하다
mbleft = 버튼이면 시작합니다
fdragging : = 참;
setRect (frect, x, y, x+32, y+32);
canvas.drawfocusrect (frect);
끝;
끝;
절차 tform3.formmouseMove (Sender : Tobject; Shift : TshiftState;
x, y : 정수);
시작하다
fdragging이 시작되면 시작하십시오
canvas.drawfocusrect (frect);
frect.left : = x;
frect.top : = y;
frect.right : = x+32;
frect.bottom : = y+32;
canvas.drawfocusrect (frect);
끝;
끝;
절차 tform3.formmouseup (sender : tobject; button : tmousebutton;
Shift : TshiftState; X, Y : Integer);
시작하다
Modalresult : = mrok;
끝;
절차 tform3.formActivate (sender : tobject);
const crhand = -18;
시작하다
screen.cursors [crhand] : = loadcursor (Hinstance, pchar ( 'cursor_1'));
커서 : = crhand;
끝;
절차 tform3.formdestroy (sender : tobject);
시작하다
fbmp.free;
screen.cursor : = crdefault;
끝;
절차 tform3.formpaint (sender : tobject);
시작하다
Canvas.Draw (0,0, FBMP);
끝;
끝.