示例#1
0
 public bool MouseCollide()
 {
     if (Rec.Contains(ScrollableGame.MousePoint.X, ScrollableGame.MousePoint.Y))
     {
         return(true);
     }
     return(false);
 }
示例#2
0
 void CatchForm_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (Rec.Contains(e.Location))
     {
         if (catchedBmp != null)
         {
             Clipboard.SetImage(catchedBmp);
             MyDispose();
         }
     }
 }
示例#3
0
        protected bool MouseCollide()
        {
            Point point;

            if (UseScrolling)
            {
                point = new Point(ScrollableGame.MousePoint.X - (int)ScrollableGame.Scrolling.X, ScrollableGame.MousePoint.Y - (int)ScrollableGame.Scrolling.Y);
            }
            else
            {
                point = ScrollableGame.MousePoint;
            }
            return(Rec.Contains(point) && ScrollableGame.InScrollableRenderTarget(point) && (ScrollableGame.CheckValidTouchLocation() || ScrollableGame.CheckLeftReleased()));
        }
示例#4
0
        public override void Update(GameTime gameTime)
        {
            if (!Enabled || !Game.IsActive)
            {
                return;
            }

            if (Rec.Contains(ScrollableGame.MousePoint))
            {
                if (ScrollableGame.CheckLeftPressed())
                {
                    _clickXDif = ScrollableGame.MousePos.X;
                    _clickYDif = ScrollableGame.MousePos.Y;
                }
                else if (ScrollableGame.CheckLeftDown())
                {
                    if (Horizontal)
                    {
                        XDif -= ScrollableGame.MousePos.X - _clickXDif;
                        if (XDif > Width - _sourceRec.Width)
                        {
                            XDif = Width - _sourceRec.Width;
                        }
                        if (XDif < 0)
                        {
                            XDif = 0;
                        }
                        _sourceRec.X = (int)XDif;
                        _clickXDif   = ScrollableGame.MousePos.X;
                    }
                    if (Vertical)
                    {
                        YDif -= ScrollableGame.MousePos.Y - _clickYDif;
                        if (YDif > Height - _sourceRec.Height)
                        {
                            YDif = Height - _sourceRec.Height;
                        }
                        if (YDif < 0)
                        {
                            YDif = 0;
                        }
                        _sourceRec.Y = (int)YDif;
                        _clickYDif   = ScrollableGame.MousePos.Y;
                    }
                }
            }

            base.Update(gameTime);
        }