(7)フォームまたはコントロール画像フォームをcraう
新しいform2を作成し、Capture2.pasとして保存します。属性ボーダリコンの4つのプロパティをfalseに設定します。
BorderStyleはBSNONEに設定されており、FormStyleはFSSTAYONTOPに設定されています。
2つの一般的な変数:FRECT:TRECT、FBMP:TBITMAP;
ユニットキャプチャ2;
インタフェース
用途
窓、メッセージ、sysutils、バリアント、クラス、グラフィック、コントロール、フォーム、
ダイアログ;
タイプ
tform2 = class(tform)
手順formcreate(sender:tobject);
手順formactivate(sender:tobject);
手順formdestroy(送信者:tobject);
手順フォームペイント(送信者:tobject);
手順formmouseup(sender:tobject; button:tmousebutton;
シフト:tshiftState; x、integer);
プライベート
{プライベート宣言}
公共
FRECT:TRECT;
FBMP:tbitmap;
終わり;
var
Form2:tform2;
実装
{$ r *.dfm}
//新しいカスタムカーソルcursor_1を作成し、capture2.resリソースに配置します
//ファイルには、キャプチャの範囲を示すために32*32の白い長方形の境界があります。
手順tform2.formcreate(sender:tobject);
var ADC:HDC;
const crhand = -18;
始める
screen.cursors [crhand]:= loadcursor(hinstance、 'cursor_1');
カーソル:= crhand;
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);
releasec(0、adc);
setbounds(0,0、screen.width、screen.height);
終わり;
手順tform2.formactivate(sender:tobject);
const crhand = -18;
始める
screen.cursors [crhand]:= loadcursor(hinstance、pchar( 'cursor_1'));
カーソル:= crhand;
終わり;
手順tform2.formdestroy(sender:tobject);
始める
fbmp.free;
screen.cursor:= crdefault;
終わり;
手順tform2.formpaint(sender:tobject);
始める
canvas.draw(0,0、fbmp);
終わり;
手順tform2.formmouseup(sender:tobject; button:tmousebutton;
シフト:tshiftState; x、integer);
始める
ModalResult:= mrok;
終わり;
終わり。