OnMouseDown
property OnMouseDown: TOnVideoMouseUpDown read FOnMouseDown write FOnMouseDown;
__property TOnVideoMouseUpDown OnMouseDown = {read=FOnMouseDown, write=FOnMouseDown};
typedef void __fastcall (__closure *TOnVideoMouseUpDown)(System::TObject* Sender, System::LongInt VideoWindow, System::Uitypes::TMouseButton Button, System::Classes::TShiftState Shift, System::LongInt X, System::LongInt Y);
void SetOnMouseDown (TOnMouseDownCb OnMouseDownCb);
typedef void CALLBACK TOnMouseDownCb (void *Object, void *Sender, int VideoWindow, TMouseButton Button, TMouseButton Shift, int X, int Y);
Occurs when the user presses a mouse button with the mouse pointer over a control.
-
if TranslateMouseCoordinates is disabled, the normal OnMouseUp event occurs and returns the real mouse coordinates across the control.
-
if TranslateMouseCoordinates is enabled, this event returns the coordinates corresponding to the native video size.
The difference appears when Display_AutoSize is disabled or PreviewZoomSize <> 100. In this case, the event reports the corresponding native video source coordinate, necessary to draw objects over video frames from the OnFrameBitmap event. Note that the BitmapInfo parameter of the OnFrameBitmap event returns directly the current mouse information.
Note: to detect if the video is displayed when the event occurs, test VideoWindow <> -1. E.g.:
procedure TfrmMainForm.VideoGrabberMouseDown(Sender: TObject; VideoWindow: Integer; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if VideoWindow <> -1 then begin // if the video is displayed
if chkFreeHandEnabled.Checked then begin
...
...
end;
end;
end;