コード例 #1
0
        /// <summary>
        /// Validates the poisition.
        /// </summary>
        /// <param name="handCursor">The hand cursor.</param>
        /// <returns></returns>
        public bool ValidatePoisition(HandCursor handCursor)
        {
            try
            {
                CursorPoint    cursorPoint   = handCursor.GetCursorPoint();
                ButtonPosition buttonPostion = this.GetPosition();
                if ((cursorPoint.X < buttonPostion.Left || cursorPoint.X > buttonPostion.Right) || cursorPoint.Y < buttonPostion.Top || cursorPoint.Y > buttonPostion.Bottom)
                {
                    if (this.ActionExit != null)
                    {
                        this.ActionExit(this, new ActionEventArgs(ActionStatus.Exit));
                    }
                    return(false);
                }

                if (this.ActionEntry != null)
                {
                    this.ActionEntry(this, new ActionEventArgs(ActionStatus.Completed));
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// Validates the poisition.
        /// </summary>
        /// <param name="handCursor">The hand cursor.</param>
        /// <returns></returns>
        public bool ValidatePoisition(HandCursor handCursor)
        {
            try
            {
                CursorPoint cursorPoint = handCursor.GetCursorPoint();
                ButtonPosition buttonPostion = this.GetPosition();
                if ((cursorPoint.X < buttonPostion.Left || cursorPoint.X > buttonPostion.Right) || cursorPoint.Y < buttonPostion.Top || cursorPoint.Y > buttonPostion.Bottom)
                {
                    if (this.ActionExit != null)
                    {
                        this.ActionExit(this, new ActionEventArgs(ActionStatus.Exit));
                    }
                    return false;
                }

                if (this.ActionEntry != null)
                {
                    this.ActionEntry(this, new ActionEventArgs(ActionStatus.Completed));
                }
                return true;
            }
            catch
            {
                return false;
            }
        }