Exemplo n.º 1
0
        protected override void OnMouseLeave(EventArgs e)
        {
            base.OnMouseLeave(e);

            if (!sliding && highlighted)
            {
                highlighted = false;
                this.Invalidate();
            }
            stateWheel = MouseWheelState.Disabled;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Event: Occurs when the mousewheel is rotated
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void PictureBox_MouseWheel(object sender, MouseEventArgs e)
        {
            MouseWheelState ms = (e.Delta < 0) ? MouseWheelState.Decrement : MouseWheelState.Increment;

            try
            {
                if (this.loadedPicture != null)
                {
                    int amount    = Math.Abs(e.Delta) / DELTA;
                    int increment = (int)ms;

                    int width  = pictureSize.Width;
                    int height = pictureSize.Height;

                    //decrement the size and ensure it is of a good size before displaying it.
                    while (amount > 0)
                    {
                        if (e.Clicks > 0)
                        {
                            increment *= 2;
                        }
                        width  += increment * WIDTH_DECREMENT;
                        height += increment * HEIGHT_DECREMENT;
                        switch (ms)
                        {
                        case MouseWheelState.Decrement:
                            if (width <= WIDTH_DECREMENT || height <= HEIGHT_DECREMENT)
                            {
                                return;
                            }
                            break;

                        case MouseWheelState.Increment:
                            if (width >= MAXIMUM_WIDTH || height > MAXIMUM_HEIGHT)
                            {
                                return;
                            }
                            break;
                        }
                        //this.loadedPicture.Image = this.Image;
                        this.Image  = null;
                        pictureSize = new Rectangle(pictureSize.X, pictureSize.Y, width, height);
                        this.Show(new f0t0page.DisplayPictureEventArgs(this.loadedPicture, pictureSize));
                        amount -= 1;
                    }
                }
            }
            catch { }
        }
Exemplo n.º 3
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (lastMove == e.Location)
            {
                return;
            }
            lastMove = e.Location;

            if (sliding)
            {
                MoveSlider(e.X - originX);
            }
            else
            {
                bool contains = (e.X >= sliderX && e.X < sliderX + sliderW && e.Y >= sliderY && e.Y < sliderY + sliderH);
                if (highlighted)
                {
                    if (!contains)
                    {
                        highlighted = false;
                        this.Invalidate();
                    }
                }
                else if (contains)
                {
                    highlighted = true;
                    this.Invalidate();
                }
            }

            switch (stateWheel)
            {
            case MouseWheelState.Disabled:
                stateWheel = MouseWheelState.Entered;
                break;

            case MouseWheelState.Entered:
                stateWheel = MouseWheelState.Enabled;
                break;
            }
        }
 internal OnMouseWheelEventArgs(dynamic state)
 {
     State = (MouseWheelState)state;
 }
Exemplo n.º 5
0
 public static void SetEnableMouseWheel(Slider element, MouseWheelState value)
 {
     element.SetValue(EnableMouseWheelProperty, value);
 }
Exemplo n.º 6
0
 public static void SetEnableMouseWheel(UIElement element, MouseWheelState value) => element.SetValue(EnableMouseWheelProperty, value);
 public static void SetEnableMouseWheel(Slider element, MouseWheelState value)
 {
     element.SetValue(EnableMouseWheelProperty, value);
 }