コード例 #1
0
        /// <summary>
        /// save changes by moving mouse to the last row and click
        /// </summary>
        protected void moveMouseOff()
        {
            bool bOK = false;

            if (_query != null)
            {
                if (_query.Tables.Count > 0)
                {
                    bOK = true;
                }
            }
            if (bOK)
            {
                try
                {
                    //remember current position
                    Point curPoint = Cursor.Position;
                    //
                    Rectangle rc = GetCurrentCellBounds();
                    Point     p2;
                    Point     p = new Point(rc.X, rc.Y + rc.Height + 2);
                    p  = PointToScreen(p);
                    p2 = new Point(rc.X, rc.Y + rc.Height + 2);
                    p2 = PointToScreen(p2);
                    //move to the next row
                    UIUtil.ClickMouse(p2.X, p2.Y);
                    Application.DoEvents();
                    Application.DoEvents();
                    UIUtil.ClickMouse(p2.X, p2.Y);
                    Application.DoEvents();
                    Application.DoEvents();
                    //move back
                    UIUtil.ClickMouse(p.X, p.Y);
                    Application.DoEvents();
                    Application.DoEvents();
                    UIUtil.ClickMouse(p.X, p.Y);
                    Application.DoEvents();
                    Application.DoEvents();
                    //move to original position
                    UIUtil.MoveMouse(curPoint.X, curPoint.Y);
                }
                catch
                {
                }
            }
        }