| 1 | unit Driver.MouseVCL;
|
|---|
| 2 |
|
|---|
| 3 | interface
|
|---|
| 4 |
|
|---|
| 5 | uses
|
|---|
| 6 | Vcl.Forms, Vcl.Controls, System.Classes, UFormMain, Xvcl.Classes, Xvcl.Kernel;
|
|---|
| 7 |
|
|---|
| 8 | type
|
|---|
| 9 | TDriverMouseVCL = class(TDriver)
|
|---|
| 10 | private
|
|---|
| 11 | procedure DoMouseDown(Sender: TObject; Button: TMouseButton;
|
|---|
| 12 | Shift: TShiftState; X, Y: Integer);
|
|---|
| 13 | procedure DoMouseUp(Sender: TObject; Button: TMouseButton;
|
|---|
| 14 | Shift: TShiftState; X, Y: Integer);
|
|---|
| 15 | procedure DoMouseMove(Sender: TObject; Shift: TShiftState;
|
|---|
| 16 | X, Y: Integer);
|
|---|
| 17 | public
|
|---|
| 18 | Form: Vcl.Forms.TForm;
|
|---|
| 19 | procedure Initialize; override;
|
|---|
| 20 | procedure Finalize; override;
|
|---|
| 21 | end;
|
|---|
| 22 |
|
|---|
| 23 | implementation
|
|---|
| 24 |
|
|---|
| 25 | procedure TDriverMouseVCL.DoMouseDown(Sender: TObject; Button: TMouseButton;
|
|---|
| 26 | Shift: TShiftState; X, Y: Integer);
|
|---|
| 27 | begin
|
|---|
| 28 | Kernel.Mouse.HandleDown(TPoint.Create(X, Y));
|
|---|
| 29 | end;
|
|---|
| 30 |
|
|---|
| 31 | procedure TDriverMouseVCL.DoMouseMove(Sender: TObject; Shift: TShiftState; X,
|
|---|
| 32 | Y: Integer);
|
|---|
| 33 | begin
|
|---|
| 34 | Kernel.Mouse.HandleMouseMove(TPoint.Create(X, Y));
|
|---|
| 35 | end;
|
|---|
| 36 |
|
|---|
| 37 | procedure TDriverMouseVCL.DoMouseUp(Sender: TObject; Button: TMouseButton;
|
|---|
| 38 | Shift: TShiftState; X, Y: Integer);
|
|---|
| 39 | begin
|
|---|
| 40 | Kernel.Mouse.HandleUp(TPoint.Create(X, Y));
|
|---|
| 41 | end;
|
|---|
| 42 |
|
|---|
| 43 | procedure TDriverMouseVCL.Finalize;
|
|---|
| 44 | begin
|
|---|
| 45 | inherited;
|
|---|
| 46 |
|
|---|
| 47 | end;
|
|---|
| 48 |
|
|---|
| 49 | procedure TDriverMouseVCL.Initialize;
|
|---|
| 50 | begin
|
|---|
| 51 | inherited;
|
|---|
| 52 | Form := Application.MainForm;
|
|---|
| 53 | TForm1(Form).Image1.OnMouseDown := DoMouseDown;
|
|---|
| 54 | TForm1(Form).Image1.OnMouseUp := DoMouseUp;
|
|---|
| 55 | TForm1(Form).Image1.OnMouseMove := DoMouseMove;
|
|---|
| 56 | end;
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 | end.
|
|---|