//private WarpPointer warp; public virtual void UpdateMaginifier() { if ((!initialized) || (hwndMag == IntPtr.Zero)) { return; } //*************************Take Eye Gaze From Left Eye**********************************************// // Point gazePoint = leftEyeGaze.GetGazePoint(); Point gazePoint = leftEyeGaze.GetWarpPoint(); Point warpPoint = leftEyeGaze.GetNextPoint(gazePoint); //overlayEyeNewForm.mTargetPoint = warpPoint; //show where am I Point //overlayEyeNewForm.wWhereAmIPoint = warpPoint; Point target = calculateTargetPoint(warpPoint); mOverlayEyeNewForm.mTargetPoint = target; //***********************************************************************************************// //RECT hostWindowRect = new RECT(); // NativeMethods.GetWindowRect(hwndMag, out hostWindowRect); int width = (int)((magWindowRect.right - magWindowRect.left) / mConfiguration.ZoomFactor); int height = (int)((magWindowRect.bottom - magWindowRect.top) / mConfiguration.ZoomFactor); RECT sourceRect = getInScreenRectFromTargetPoint(target, width, height); // Set the magnification factor. NativeMethods.MagTransform matrix = new NativeMethods.MagTransform(mConfiguration.ZoomFactor); NativeMethods.MagSetWindowTransform(hwndMag, ref matrix); if (mConfiguration.HideMouseCursor == true) { NativeMethods.MagShowSystemCursor(false); } else if (mConfiguration.HideMouseCursor == false) { NativeMethods.MagShowSystemCursor(true); } setColor(); // Set the source rectangle for the magnifier control. bool ret = NativeMethods.MagSetWindowSource(hwndMag, sourceRect); POINT cursor = new POINT(); NativeMethods.GetCursorPos(ref cursor); // The reason why "right" and "bottom" minus the 10 is, normally the image // of the cursor is shown at the bottom right of the cursor position, // if they don't minus some pixel, the cursor will stay outside of the magnifier. if (cursor.x <= sourceRect.left) { cursor.x = sourceRect.left; } if (cursor.x >= sourceRect.right) { cursor.x = sourceRect.right - 10; } if (cursor.y <= sourceRect.top) { cursor.y = sourceRect.top; } if (cursor.y >= sourceRect.bottom) { cursor.y = sourceRect.bottom - 10; } NativeMethods.SetCursorPos(cursor.x, cursor.y); // NativeMethods.ShowCursor(true); NativeMethods.ShowCursor(true); //NativeMethods.MagShowSystemCursor(FALSE); if (this.form == null) { timer.Enabled = false; return; } if (this.form.IsDisposed) { timer.Enabled = false; return; } //Reclaim topmost status, to prevent unmagnified menus from remaining in view. NativeMethods.SetWindowPos(hwndMag, NativeMethods.HWND_TOPMOST, 0, 0, 0, 0, (int)SetWindowPosFlags.SWP_NOACTIVATE | (int)SetWindowPosFlags.SWP_NOMOVE | (int)SetWindowPosFlags.SWP_NOSIZE); //setWindowsPosition(); // Force redraw. NativeMethods.InvalidateRect(hwndMag, IntPtr.Zero, true); }