BiomePainter.BitmapSelector.BitmapSelector.BitmapSelector_MouseWheel C# (CSharp) 메소드

BitmapSelector_MouseWheel() 개인적인 메소드

private BitmapSelector_MouseWheel ( object sender, MouseEventArgs e ) : void
sender object
e MouseEventArgs
리턴 void
        private void BitmapSelector_MouseWheel(object sender, MouseEventArgs e)
        {
            if (Control.ModifierKeys == Keys.Control)
            {
                BrushDiameter = BrushDiameter + e.Delta / 120;
                if (BrushDiameter > BrushDiameterMax)
                    BrushDiameter = BrushDiameterMax;
                else if (BrushDiameter < 1)
                    BrushDiameter = 1;

                if (Layers[BrushLayerIndex].Visible && this.ClientRectangle.Contains(e.Location))
                {
                    RedrawBrushLayer(Translate(e.Location));
                    Redraw();
                }
                OnBrushDiameterChanged(new BrushDiameterEventArgs(BrushDiameter));
            }
            else if (Control.ModifierKeys == Keys.Alt)
            {
                if (e.Delta > 0)
                {
                    for (int i = 0; i < e.Delta / 120; i++)
                        PanUp();
                }
                else
                {
                    for (int i = 0; i < -e.Delta / 120; i++)
                        PanDown();
                }
            }
            else if (Control.ModifierKeys == Keys.Shift)
            {
                if (e.Delta > 0)
                {
                    for (int i = 0; i < e.Delta / 120; i++)
                        PanLeft();
                }
                else
                {
                    for (int i = 0; i < -e.Delta / 120; i++)
                        PanRight();
                }
            }
            else
            {
                Point p = new Point(e.Location.X, e.Location.Y);
                if (p.X < 0)
                    p.X = 0;
                if (p.X > Width)
                    p.X = Width;
                if (p.Y < 0)
                    p.Y = 0;
                if (p.Y > Height)
                    p.Y = Height;

                p = Translate(p);

                double percentOffsetX = ((double)(p.X - OffsetX)) / (((double)Width) / (double)Magnification);
                double percentOffsetY = ((double)(p.Y - OffsetY)) / (((double)Width) / (double)Magnification);

                int newMagnification = Magnification + e.Delta / 120;
                if (newMagnification <= 0)
                    newMagnification = 1;
                else if (newMagnification > MagnificationMax)
                    newMagnification = MagnificationMax;

                Zoom(newMagnification, OffsetX, OffsetY, false);
                Zoom(Magnification, p.X - (int)Math.Round(percentOffsetX * (((double)Width) / (double)Magnification)), p.Y - (int)Math.Round(percentOffsetY * (((double)Width) / (double)Magnification)));
            }
        }