public static extern bool GetGestureInfo(IntPtr hGestureInfo, ref GESTUREINFO pGestureInfo);
//Decode the gesture private void DecodeGesture(IHwndWrapper hWndWrapper, ref GESTUREINFO gestureInfo) { Location = hWndWrapper.PointToClient(new Point(gestureInfo.ptsLocation.x, gestureInfo.ptsLocation.y)); Center = Location; switch (GestureId) { case User32.GID_ROTATE: ushort lastArguments = (ushort)(IsBegin ? 0 : LastEvent.GestureArguments); RotateAngle = User32.GID_ROTATE_ANGLE_FROM_ARGUMENT((ushort)(gestureInfo.ullArguments - lastArguments)); break; case User32.GID_ZOOM: Point first = IsBegin ? Location : LastBeginEvent.Location; Center = new Point((Location.X + first.X) / 2, (Location.Y + first.Y) / 2); ZoomFactor = IsBegin ? 1 : (double)gestureInfo.ullArguments / LastEvent.GestureArguments; //DistanceBetweenFingers = User32.LoDWord(gestureInfo.ullArguments); break; case User32.GID_PAN: PanTranslation = IsBegin ? new Size(0, 0) : new Size(Location.X - LastEvent.Location.X, Location.Y - LastEvent.Location.Y); int panVelocity = User32.HiDWord((long)(gestureInfo.ullArguments)); PanVelocity = new Size(User32.LoWord(panVelocity), User32.HiWord(panVelocity)); //DistanceBetweenFingers = User32.LoDWord(gestureInfo.ullArguments); break; } }
/// <summary> /// The Windows message interception for gesture events handling /// </summary> /// <param name="hWnd">WndProc hWnd</param> /// <param name="msg">WndProc msg</param> /// <param name="wParam">WndProc wParam</param> /// <param name="lParam">WndProc lParam</param> /// <returns>WndProc return</returns> public override uint WindowProc(IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam) { //We care only for gesture events if (msg != User32.WM_GESTURE) { return(0); } GESTUREINFO gestureInfo = new GESTUREINFO { cbSize = (uint)Marshal.SizeOf(typeof(GESTUREINFO)) }; bool result = User32.GetGestureInfo(lParam, ref gestureInfo); if (!result) { throw new Exception("Cannot get gesture information"); } //Decode the gesture info and get the message event argument GestureEventArgs eventArgs = new GestureEventArgs(this, ref gestureInfo); try { //Fire the event using the event map _eventMap[MapWM2EventId(gestureInfo.dwID, gestureInfo.dwFlags)].Invoke(this, eventArgs); } catch (ArgumentOutOfRangeException) //In case future releases will introduce new event values { } //Keep the last message for relative calculations LastEvent = eventArgs; //Keep the first message for relative calculations if (eventArgs.IsBegin) { LastBeginEvent = eventArgs; } User32.CloseGestureInfoHandle(lParam); return(1); }
/// <summary> /// Create new gesture event instance and decode the gesture info structure /// </summary> /// <param name="handler">The gesture handler</param> /// <param name="gestureInfo">The gesture information</param> internal GestureEventArgs(GestureHandler handler, ref GESTUREINFO gestureInfo) { _dwFlags = gestureInfo.dwFlags; GestureId = gestureInfo.dwID; GestureArguments = gestureInfo.ullArguments; //Get the last event from the handler LastEvent = handler.LastEvent; //Get the last begin event from the handler LastBeginEvent = handler.LastBeginEvent; DecodeGesture(handler.HWndWrapper, ref gestureInfo); //new gesture, clear last and first event fields if (IsBegin) { LastBeginEvent = null; LastEvent = null; } }
private static extern bool GetGestureInfo(IntPtr hGestureInfo, ref GESTUREINFO pGestureInfo);
private IEnumerable <GestureNotification> GenerateGestureNotifications(WMEventArgs e) { if (e.Message == WM.GESTURENOTIFY) { e.Handled = FEnabledIn[0]; yield break; } else { var gestureInfo = new GESTUREINFO(); gestureInfo.cbSize = FGestureInfoSize; if (User32.GetGestureInfo(e.LParam, ref gestureInfo)) { try { RECT cr; if (User32.GetClientRect(e.HWnd, out cr)) { var position = new Point(gestureInfo.x, gestureInfo.y); User32.ScreenToClient(e.HWnd, ref position); e.Handled = true; switch ((GestureNotificationKind)gestureInfo.dwID) { case GestureNotificationKind.GestureBegin: yield return(new GestureBeginNotification(position, new Size(cr.Width, cr.Height), gestureInfo.dwInstanceID, gestureInfo.dwSequenceID, gestureInfo.hwndTarget.ToInt64(), gestureInfo.dwFlags, gestureInfo.ullArguments, gestureInfo.cbExtraArgs)); break; case GestureNotificationKind.GestureEnd: yield return(new GestureEndNotification(position, new Size(cr.Width, cr.Height), gestureInfo.dwInstanceID, gestureInfo.dwSequenceID, gestureInfo.hwndTarget.ToInt64(), gestureInfo.dwFlags, gestureInfo.ullArguments, gestureInfo.cbExtraArgs)); break; case GestureNotificationKind.GestureZoom: yield return(new GestureZoomNotification(position, new Size(cr.Width, cr.Height), gestureInfo.dwInstanceID, gestureInfo.dwSequenceID, gestureInfo.hwndTarget.ToInt64(), gestureInfo.dwFlags, gestureInfo.ullArguments, gestureInfo.cbExtraArgs)); break; case GestureNotificationKind.GesturePan: yield return(new GesturePanNotification(position, new Size(cr.Width, cr.Height), gestureInfo.dwInstanceID, gestureInfo.dwSequenceID, gestureInfo.hwndTarget.ToInt64(), gestureInfo.dwFlags, gestureInfo.ullArguments, gestureInfo.cbExtraArgs)); break; case GestureNotificationKind.GestureRotate: yield return(new GestureRotateNotification(position, new Size(cr.Width, cr.Height), gestureInfo.dwInstanceID, gestureInfo.dwSequenceID, gestureInfo.hwndTarget.ToInt64(), gestureInfo.dwFlags, gestureInfo.ullArguments, gestureInfo.cbExtraArgs)); break; case GestureNotificationKind.GesturePressAndTap: yield return(new GesturePressAndTapNotification(position, new Size(cr.Width, cr.Height), gestureInfo.dwInstanceID, gestureInfo.dwSequenceID, gestureInfo.hwndTarget.ToInt64(), gestureInfo.dwFlags, gestureInfo.ullArguments, gestureInfo.cbExtraArgs)); break; case GestureNotificationKind.GestureTwoFingerTap: yield return(new GestureTwoFingerTapNotification(position, new Size(cr.Width, cr.Height), gestureInfo.dwInstanceID, gestureInfo.dwSequenceID, gestureInfo.hwndTarget.ToInt64(), gestureInfo.dwFlags, gestureInfo.ullArguments, gestureInfo.cbExtraArgs)); break; default: yield break; } } } finally { e.Handled = false; } } yield break; } }
// Handler of gestures //in: // m - Message object private bool DecodeGesture(ref Message m) { GESTUREINFO gi; try { gi = new GESTUREINFO(); } catch (Exception) { return(false); } gi.cbSize = _gestureInfoSize; // Load the gesture information. // We must p/invoke into user32 [winuser.h] if (!GetGestureInfo(m.LParam, ref gi)) { return(false); } switch (gi.dwID) { case GID_BEGIN: case GID_END: break; case GID_ZOOM: switch (gi.dwFlags) { case GF_BEGIN: _iArguments = (int)(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK); _ptFirst.X = gi.ptsLocation.x; _ptFirst.Y = gi.ptsLocation.y; _ptFirst = PointToClient(_ptFirst); break; default: // We read here the second point of the gesture. This // is middle point between fingers in this new // position. _ptSecond.X = gi.ptsLocation.x; _ptSecond.Y = gi.ptsLocation.y; _ptSecond = PointToClient(_ptSecond); { // The zoom factor is the ratio of the new // and the old distance. The new distance // between two fingers is stored in // gi.ullArguments (lower 4 bytes) and the old // distance is stored in _iArguments. double k = (double)(_iArguments) / (double)(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK); //lblX.Text = k.ToString(); camera.zoomValue *= k; if (camera.zoomValue < 6.0) { camera.zoomValue = 6; } camera.camSetDistance = camera.zoomValue * camera.zoomValue * -1; SetZoom(); } // Now we have to store new information as a starting // information for the next step in this gesture. _ptFirst = _ptSecond; _iArguments = (int)(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK); break; } break; //case GID_PAN: // switch (gi.dwFlags) // { // case GF_BEGIN: // _ptFirst.X = gi.ptsLocation.x; // _ptFirst.Y = gi.ptsLocation.y; // _ptFirst = PointToClient(_ptFirst); // break; // default: // // We read the second point of this gesture. It is a // // middle point between fingers in this new position // _ptSecond.X = gi.ptsLocation.x; // _ptSecond.Y = gi.ptsLocation.y; // _ptSecond = PointToClient(_ptSecond); // // We apply move operation of the object // _dwo.Move(_ptSecond.X - _ptFirst.X, _ptSecond.Y - _ptFirst.Y); // Invalidate(); // // We have to copy second point into first one to // // prepare for the next step of this gesture. // _ptFirst = _ptSecond; // break; // } // break; case GID_ROTATE: switch (gi.dwFlags) { case GF_BEGIN: _iArguments = 32768; break; default: // Gesture handler returns cumulative rotation angle. However we // have to pass the delta angle to our function responsible // to process the rotation gesture. double k = ((int)(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK) - _iArguments) * 0.01; camera.camPitch -= k; if (camera.camPitch < -80) { camera.camPitch = -80; } if (camera.camPitch > 0) { camera.camPitch = 0; } _iArguments = (int)(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK); break; } break; //case GID_TWOFINGERTAP: // // Toggle drawing of diagonals // _dwo.ToggleDrawDiagonals(); // Invalidate(); // break; //case GID_PRESSANDTAP: // if (gi.dwFlags == GF_BEGIN) // { // // Shift drawing color // _dwo.ShiftColor(); // Invalidate(); // } // break; } return(true); }
private bool DecodeGesture(ref Message m) { GESTUREINFO gi; try { gi = new GESTUREINFO(); } catch (Exception excep) { Debug.Print("Could not allocate resources to decode gesture"); Debug.Print(excep.ToString()); return(false); } gi.cbSize = _gestureInfoSize; // Load the gesture information. // We must p/invoke into user32 [winuser.h] if (!GetGestureInfo(m.LParam, ref gi)) { return(false); } switch (gi.dwID) { case GID_BEGIN: case GID_END: break; case GID_ZOOM: switch (gi.dwFlags) { case GF_BEGIN: _iArguments = (int)(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK); _ptFirst.X = gi.ptsLocation.x; _ptFirst.Y = gi.ptsLocation.y; _ptFirst = PointToClient(_ptFirst); break; default: // We read here the second point of the gesture. This // is middle point between fingers in this new // position. _ptSecond.X = gi.ptsLocation.x; _ptSecond.Y = gi.ptsLocation.y; _ptSecond = PointToClient(_ptSecond); { // We have to calculate zoom center point Point ptZoomCenter = new Point((_ptFirst.X + _ptSecond.X) / 2, (_ptFirst.Y + _ptSecond.Y) / 2); // The zoom factor is the ratio of the new // and the old distance. The new distance // between two fingers is stored in // gi.ullArguments (lower 4 bytes) and the old // distance is stored in _iArguments. double k = (double)(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK) / (double)(_iArguments); // Now we process zooming in/out of the object //_dwo.Zoom(k, ptZoomCenter.X, ptZoomCenter.Y); Invalidate(); } // Now we have to store new information as a starting // information for the next step in this gesture. _ptFirst = _ptSecond; _iArguments = (int)(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK); break; } break; case GID_PAN: switch (gi.dwFlags) { case GF_BEGIN: _ptFirst.X = gi.ptsLocation.x; _ptFirst.Y = gi.ptsLocation.y; _ptFirst = PointToClient(_ptFirst); break; default: // We read the second point of this gesture. It is a // middle point between fingers in this new position _ptSecond.X = gi.ptsLocation.x; _ptSecond.Y = gi.ptsLocation.y; _ptSecond = PointToClient(_ptSecond); //----------- //MessageBox.Show(gi.ullArguments.ToString()); var offset_x = _ptSecond.X - _ptFirst.X; var offset_y = _ptSecond.Y - _ptFirst.Y; var ea = new GestureEventArgs(offset_x, offset_y, GestureId.GID_PAN); this.OnGesture(ea); //----------- // We apply move operation of the object //_dwo.Move(_ptSecond.X - _ptFirst.X, _ptSecond.Y - _ptFirst.Y); Invalidate(); // We have to copy second point into first one to // prepare for the next step of this gesture. _ptFirst = _ptSecond; break; } break; case GID_ROTATE: switch (gi.dwFlags) { case GF_BEGIN: _iArguments = 0; break; default: _ptFirst.X = gi.ptsLocation.x; _ptFirst.Y = gi.ptsLocation.y; _ptFirst = PointToClient(_ptFirst); // Gesture handler returns cumulative rotation angle. However we // have to pass the delta angle to our function responsible // to process the rotation gesture. //_dwo.Rotate( // ArgToRadians(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK) // - ArgToRadians(_iArguments), // _ptFirst.X, _ptFirst.Y //); Invalidate(); _iArguments = (int)(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK); break; } break; case GID_TWOFINGERTAP: // Toggle drawing of diagonals //_dwo.ToggleDrawDiagonals(); Invalidate(); break; case GID_PRESSANDTAP: if (gi.dwFlags == GF_BEGIN) { // Shift drawing color //_dwo.ShiftColor(); Invalidate(); } break; } return(true); }
public static bool GetGestureInfo(IntPtr hGestureInfo, ref GESTUREINFO pGestureInfo) { NotImplemented(MethodBase.GetCurrentMethod()); return(false); }
private bool DecodeGesture(ref Message m) { touchscroll = true; GESTUREINFO gi; try { gi = new GESTUREINFO(); } catch (Exception excep) { Debug.Print("Could not allocate resources to decode gesture"); Debug.Print(excep.ToString()); return(false); } gi.cbSize = _gestureInfoSize; // Load the gesture information. // We must p/invoke into user32 [winuser.h] if (!GetGestureInfo(m.LParam, ref gi)) { return(false); } switch (gi.dwID) { case GID_BEGIN: case GID_END: break; case GID_PAN: switch (gi.dwFlags) { case GF_BEGIN: First = gi.ptsLocation.x; _ptFirst.X = gi.ptsLocation.x; _ptFirst.Y = gi.ptsLocation.y; _ptFirst = PointToClient(_ptFirst); break; default: // We read the second point of this gesture. It is a // middle point between fingers in this new position _ptSecond.X = gi.ptsLocation.x; _ptSecond.Y = gi.ptsLocation.y; _ptSecond = PointToClient(_ptSecond); Second = _ptSecond.X; #region [ Grouping ] drawingLocation = _ptSecond; // We apply move operation of the object if (_ptSecond.X >= this.panel2.Location.X && _ptSecond.Y >= this.panel2.Location.Y && this._ptSecond.X <= (this.panel2.Location.X + this.panel2.Width) && this._ptSecond.Y <= (this.panel2.Location.Y + this.panel2.Height)) { beginRange = this.gridGroupingControl1.TableControl.PointToRangeInfo(_ptFirst); if (beginRange.Top != 0 && _ptFirst != _ptSecond) { if (_ptSecond.Y > _ptFirst.Y) { if (beginRange.Bottom > 10) { if (beginRange.Bottom - 10 < this.gridGroupingControl1.TableControl.TopRowIndex) { this.gridGroupingControl1.TableControl.ScrollCellInView(beginRange.Bottom - 10, beginRange.Left, GridScrollCurrentCellReason.MoveTo); } else if (beginRange.Bottom - 10 > this.gridGroupingControl1.TableControl.TopRowIndex) { this.gridGroupingControl1.TableControl.ScrollCellInView(this.gridGroupingControl1.TableControl.TopRowIndex, beginRange.Left, GridScrollCurrentCellReason.MoveTo); } } else { this.gridGroupingControl1.TableControl.ScrollCellInView(0, 0, GridScrollCurrentCellReason.MoveTo); } } else if (_ptSecond.Y < _ptFirst.Y) { if (beginRange.Bottom + 10 < this.gridGroupingControl1.TableModel.RowCount) { this.gridGroupingControl1.TableControl.ScrollCellInView(beginRange.Bottom + 10, beginRange.Left, GridScrollCurrentCellReason.MoveTo); } else if (beginRange.Bottom + 10 > this.gridGroupingControl1.TableModel.RowCount) { this.gridGroupingControl1.TableControl.ScrollCellInView(this.gridGroupingControl1.TableModel.RowCount, beginRange.Left, GridScrollCurrentCellReason.MoveTo); } } else if (_ptSecond.X > _ptFirst.X) { if (beginRange.Left - 10 < this.gridGroupingControl1.TableControl.LeftColIndex) { this.gridGroupingControl1.TableControl.ScrollCellInView(beginRange.Top, (beginRange.Left - 10 > this.gridGroupingControl1.TableControl.LeftColIndex ? beginRange.Left - 10 : this.gridGroupingControl1.TableControl.LeftColIndex), GridScrollCurrentCellReason.MoveTo); } } else if (_ptSecond.X < _ptFirst.X) { if (beginRange.Left + 10 < this.gridGroupingControl1.TableModel.ColCount) { this.gridGroupingControl1.TableControl.ScrollCellInView(beginRange.Top, beginRange.Left + 10, GridScrollCurrentCellReason.MoveTo); } else if (beginRange.Left + 10 > this.gridGroupingControl1.TableModel.ColCount) { this.gridGroupingControl1.TableControl.ScrollCellInView(beginRange.Top, this.gridGroupingControl1.TableModel.ColCount, GridScrollCurrentCellReason.MoveTo); } Bitmap bm = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height); this.gridGroupingControl1.TableControl.DrawToBitmap(bm, this.ClientRectangle); gridBitmap = bm; Graphics g = null; try { g = Graphics.FromImage(bm); g.DrawImage(bm, _ptSecond); } finally { if (g != null) { // g.Dispose(); } } } } } #endregion // We have to copy second point into first one to // prepare for the next step of this gesture. _ptFirst = _ptSecond; break; } break; } return(true); }
// Handler of gestures //in: // m - Message object private bool DecodeGesture(ref Message m) { GESTUREINFO gi; try { gi = new GESTUREINFO(); } catch (Exception excep) { Debug.Print("Could not allocate resources to decode gesture"); Debug.Print(excep.ToString()); return false; } gi.cbSize = _gestureInfoSize; // Load the gesture information. // We must p/invoke into user32 [winuser.h] if(!GetGestureInfo(m.LParam,ref gi)) { return false; } switch (gi.dwID) { case GID_BEGIN: case GID_END: break; case GID_ZOOM: switch (gi.dwFlags) { case GF_BEGIN: _iArguments = (int)(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK); _ptFirst.X = gi.ptsLocation.x; _ptFirst.Y = gi.ptsLocation.y; _ptFirst = PointToClient(_ptFirst); break; default: // We read here the second point of the gesture. This // is middle point between fingers in this new // position. _ptSecond.X = gi.ptsLocation.x; _ptSecond.Y = gi.ptsLocation.y; _ptSecond = PointToClient(_ptSecond); { // We have to calculate zoom center point Point ptZoomCenter = new Point((_ptFirst.X + _ptSecond.X) / 2, (_ptFirst.Y + _ptSecond.Y) / 2); // The zoom factor is the ratio of the new // and the old distance. The new distance // between two fingers is stored in // gi.ullArguments (lower 4 bytes) and the old // distance is stored in _iArguments. double k = (double)(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK) / (double)(_iArguments); // Now we process zooming in/out of the object _dwo.Zoom(k, ptZoomCenter.X, ptZoomCenter.Y); Invalidate(); } // Now we have to store new information as a starting // information for the next step in this gesture. _ptFirst = _ptSecond; _iArguments = (int)(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK); break; } break; case GID_PAN: switch (gi.dwFlags) { case GF_BEGIN: _ptFirst.X = gi.ptsLocation.x; _ptFirst.Y = gi.ptsLocation.y; _ptFirst = PointToClient(_ptFirst); break; default: // We read the second point of this gesture. It is a // middle point between fingers in this new position _ptSecond.X = gi.ptsLocation.x; _ptSecond.Y = gi.ptsLocation.y; _ptSecond = PointToClient(_ptSecond); // We apply move operation of the object _dwo.Move(_ptSecond.X - _ptFirst.X, _ptSecond.Y - _ptFirst.Y); Invalidate(); // We have to copy second point into first one to // prepare for the next step of this gesture. _ptFirst = _ptSecond; break; } break; case GID_ROTATE: switch (gi.dwFlags) { case GF_BEGIN: _iArguments = 0; break; default: _ptFirst.X = gi.ptsLocation.x; _ptFirst.Y = gi.ptsLocation.y; _ptFirst = PointToClient(_ptFirst); // Gesture handler returns cumulative rotation angle. However we // have to pass the delta angle to our function responsible // to process the rotation gesture. _dwo.Rotate( ArgToRadians(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK) - ArgToRadians(_iArguments), _ptFirst.X, _ptFirst.Y ); Invalidate(); _iArguments = (int)(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK); break; } break; case GID_TWOFINGERTAP: // Toggle drawing of diagonals _dwo.ToggleDrawDiagonals(); Invalidate(); break; case GID_PRESSANDTAP: if (gi.dwFlags == GF_BEGIN) { // Shift drawing color _dwo.ShiftColor(); Invalidate(); } break; } return true; }
// Handler of gestures //in: // m - Message object private bool DecodeGesture(ref Message m) { GESTUREINFO gi; try { gi = new GESTUREINFO(); } catch (Exception excep) { Debug.Print("Could not allocate resources to decode gesture"); Debug.Print(excep.ToString()); return(false); } gi.cbSize = _gestureInfoSize; // Load the gesture information. // We must p/invoke into user32 [winuser.h] if (!GetGestureInfo(m.LParam, ref gi)) { return(false); } switch (gi.dwID) { case GID_BEGIN: case GID_END: break; case GID_ZOOM: switch (gi.dwFlags) { case GF_BEGIN: _iArguments = (int)(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK); _ptFirst.X = gi.ptsLocation.x; _ptFirst.Y = gi.ptsLocation.y; _ptFirst = PointToClient(_ptFirst); break; default: // We read here the second point of the gesture. This // is middle point between fingers in this new // position. _ptSecond.X = gi.ptsLocation.x; _ptSecond.Y = gi.ptsLocation.y; _ptSecond = PointToClient(_ptSecond); { // We have to calculate zoom center point Point ptZoomCenter = new Point((_ptFirst.X + _ptSecond.X) / 2, (_ptFirst.Y + _ptSecond.Y) / 2); // The zoom factor is the ratio of the new // and the old distance. The new distance // between two fingers is stored in // gi.ullArguments (lower 4 bytes) and the old // distance is stored in _iArguments. double k = (double)(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK) / (double)(_iArguments); // Now we process zooming in/out of the object _dwo.Zoom(k, ptZoomCenter.X, ptZoomCenter.Y); Invalidate(); } // Now we have to store new information as a starting // information for the next step in this gesture. _ptFirst = _ptSecond; _iArguments = (int)(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK); break; } break; } return(true); }
private bool DecodeGesture(ref Message m) { GESTUREINFO gi; try { gi = new GESTUREINFO(); } catch (Exception excep) { Debug.Print("Could not allocate resources to decode gesture"); Debug.Print(excep.ToString()); return(false); } gi.cbSize = _gestureInfoSize; if (!GetGestureInfo(m.LParam, ref gi)) { return(false); } switch (gi.dwID) { case GID_BEGIN: case GID_END: { break; } case GID_TWOFINGERTAP: { break; } case GID_ZOOM: { switch (gi.dwFlags) { case GF_BEGIN: { iArguments = System.Convert.ToInt32(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK); first_point.X = gi.ptsLocation.x; first_point.Y = gi.ptsLocation.y; first_pointLL = FromLocalToLatLng(PointToClient(first_point)); break; } default: { second_point.X = gi.ptsLocation.x; second_point.Y = gi.ptsLocation.y; second_pointLL = FromLocalToLatLng(PointToClient(second_point)); GestureHappened?.Invoke(this, new GestureEventArgs() { Operation = Gestures.Zoom, DistanceBetweenStart = iArguments, DistanceBetweenNow = System.Convert.ToInt32(gi.ullArguments & ULL_ARGUMENTS_BIT_MASK), FirstPoint = first_point, SecondPoint = second_point, FirstPointLL = first_pointLL, SecondPointLL = second_pointLL }); break; } } break; } case GID_PAN: { switch (gi.dwFlags) { case GF_BEGIN: { first_point.X = gi.ptsLocation.x; first_point.Y = gi.ptsLocation.y; first_pointLL = FromLocalToLatLng(PointToClient(first_point)); break; } default: { second_point.X = gi.ptsLocation.x; second_point.Y = gi.ptsLocation.y; second_pointLL = FromLocalToLatLng(PointToClient(second_point)); GestureHappened?.Invoke(this, new GestureEventArgs() { Operation = Gestures.Pan, FirstPoint = first_point, SecondPoint = second_point, FirstPointLL = first_pointLL, SecondPointLL = second_pointLL }); break; } } break; } case GID_PRESSANDTAP: { break; } case GID_ROTATE: { break; } } return(true); }
internal RotateGestureEventArgs(double angle, GESTUREINFO gestureInfo, RadControl owner) : base(gestureInfo, owner) { this.angle = angle; }