HamSketch.UISurface.OnMouseEnter C# (CSharp) Method

OnMouseEnter() public method

public OnMouseEnter ( MouseEventArgs e ) : void
e MouseEventArgs
return void
        public virtual void OnMouseEnter(MouseEventArgs e)
        {
            if (null != MouseEnterEvent)
                MouseEnterEvent(e);
        }

Usage Example

Example #1
0
        public override void OnMouseMove(MouseEventArgs e)
        {
            //Console.WriteLine("MetaSpace.OnMouseMove - {0}", e.ToString());
            UISurface tracker = GetUISurfaceAt(e.X, e.Y);

            // If the current tracker is the same as who we've
            // already been tracking
            // then we just send it a mousemove event.
            if ((tracker != null) && (tracker == fMouseTracker))
            {
                // Create a new mouse event with the point translated into the 
                // coordinate space of the client
                MouseEventArgs args = new MouseEventArgs(0, MouseEventType.MouseMove, e.Button, e.Clicks,
                    (e.X-tracker.Frame.Left), (e.Y-tracker.Frame.Top), e.Delta, e.Source);

                fMouseTracker.OnMouseMove(args);
                
                return;
            }

            // If the tracker is different
            // Then the current tracker needs to receive the MouseExit event
            if (fMouseTracker != null)
            {
                // Create a new mouse event with the point translated into the 
                // coordinate space of the client
                MouseEventArgs args = new MouseEventArgs(0, MouseEventType.MouseLeave, e.Button, e.Clicks,
                    e.X - fMouseTracker.Frame.Left, e.Y-fMouseTracker.Frame.Top, e.Delta, e.Source);

                fMouseTracker.OnMouseLeave(args);
            }

            fMouseTracker = tracker;

            if (fMouseTracker != null)
            {
                // Create a new mouse event with the point translated into the 
                // coordinate space of the client
                MouseEventArgs args = new MouseEventArgs(0, MouseEventType.MouseEnter, e.Button, e.Clicks,
                    e.X-fMouseTracker.Frame.Left, e.Y-fMouseTracker.Frame.Top, e.Delta, e.Source);

                fMouseTracker.OnMouseEnter(args);
            }
            else
            {
                // Otherwise, no trackers have been hit, so we're just free floating
                // in the window.  Set the cursor to the generic arrow
                //Win32Cursor.Current = Win32Cursor.Arrow;
            }

            base.OnMouseMove(e);
        }