Exemple #1
0
 private void pictureBox2_MouseUp(object sender, MouseEventArgs e)
 {
     if (!checkBoxGray.Checked)
     {
         return;
     }
     changeing      = false;
     where          = changeType.none;
     GrayPic.Cursor = Cursors.Default;
 }
Exemple #2
0
        private void pictureBox2_MouseDown(object sender, MouseEventArgs e)
        {
            Focus();
            EnterHandle();
            if (!checkBoxGray.Checked)
            {
                return;
            }
            switch (GetChangeType(e.Location))
            {
            case changeType.none:
                changeing = false;
                where     = changeType.none;
                break;

            case changeType.uDown:
                GrayEditor.Down++;
                break;

            case changeType.uUp:
                GrayEditor.Up++;
                break;

            case changeType.dDown:
                GrayEditor.Down--;
                break;

            case changeType.dUp:
                GrayEditor.Up--;
                break;

            default:
                changeing   = true;
                mouseDownUp = e.X - GrayEditor.Up;    // maximum - maximum * e.Y / pictureBox1.Height - up;
                pictureBox2_MouseMove(sender, e);
                break;
            }
        }
Exemple #3
0
        private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
        {
            if (GetFocus != null)
            {
                GetFocus(this, new EventArgs());
            }

            switch (GetChangeType(e.Location))
            {
            case changeType.none:
                changeing = false;
                where     = changeType.none;
                break;

            case changeType.uDown:
                textBox2.Text = (down + 1).ToString();
                break;

            case changeType.uUp:
                textBox1.Text = (up + 1).ToString();
                break;

            case changeType.dDown:
                textBox2.Text = (down - 1).ToString();
                break;

            case changeType.dUp:
                textBox1.Text = (up - 1).ToString();
                break;

            default:
                changeing     = true;
                mouseDownDelt = maximum - maximum * e.Y / pictureBox1.Height - up;
                pictureBox1_MouseMove(sender, e);
                break;
            }
        }
Exemple #4
0
        private changeType GetChangeType(Point e)
        {
            Rectangle rect = new Rectangle(GrayEditor.Down, 0, GrayEditor.Up - GrayEditor.Down, GrayPic.ClientSize.Height);
            int       delt = 3;

            if ((e.X < rect.X - delt))
            {
                where          = changeType.dDown;
                GrayPic.Cursor = Cursors.PanWest;
            }
            else if ((e.X > rect.Right + delt))
            {
                where          = changeType.uUp;
                GrayPic.Cursor = Cursors.PanEast;
            }
            else
            {
                if (e.X < rect.Left + delt)
                {
                    if (e.X > rect.Right)
                    {
                        where = changeType.up;
                    }
                    else
                    {
                        where = changeType.down;
                    }
                    GrayPic.Cursor = Cursors.SizeWE;
                }
                else if (e.X > rect.Right - delt)
                {
                    if (e.X < rect.Left)
                    {
                        where = changeType.down;
                    }
                    else
                    {
                        where = changeType.up;
                    }
                    GrayPic.Cursor = Cursors.SizeWE;
                }
                else if (rect.Width > 10 * delt)
                {
                    if (e.X < rect.Left + 4 * delt)
                    {
                        where          = changeType.uDown;
                        GrayPic.Cursor = Cursors.PanEast;
                    }
                    else if (e.X > rect.Right - 4 * delt)
                    {
                        where          = changeType.dUp;
                        GrayPic.Cursor = Cursors.PanWest;
                    }
                    else
                    {
                        where          = changeType.all;
                        GrayPic.Cursor = Cursors.SizeAll;
                    }
                }
                else
                {
                    where          = changeType.all;
                    GrayPic.Cursor = Cursors.SizeAll;
                }
            }
            return(where);
        }
Exemple #5
0
 private changeType GetChangeType(Point e)
 {
     if ((e.Y < rect.Y - delt))
     {
         where = changeType.uUp;
         pictureBox1.Cursor = Cursors.PanNorth;
     }
     else if ((e.Y > rect.Bottom + delt))
     {
         where = changeType.dDown;
         pictureBox1.Cursor = Cursors.PanSouth;
     }
     else
     {
         if (e.Y < rect.Top + delt)
         {
             if (e.Y > rect.Bottom)
             {
                 where = changeType.down;
             }
             else
             {
                 where = changeType.up;
             }
             pictureBox1.Cursor = Cursors.SizeNS;
         }
         else if (e.Y > rect.Bottom - delt)
         {
             if (e.Y < rect.Top)
             {
                 where = changeType.up;
             }
             else
             {
                 where = changeType.down;
             }
             pictureBox1.Cursor = Cursors.SizeNS;
         }
         else if (rect.Height * (up - down) / maximum > 10 * delt)
         {
             if (e.Y < rect.Top + 4 * delt)
             {
                 where = changeType.dUp;
                 pictureBox1.Cursor = Cursors.PanSouth;
             }
             else if (e.Y > rect.Bottom - 4 * delt)
             {
                 where = changeType.uDown;
                 pictureBox1.Cursor = Cursors.PanNorth;
             }
             else
             {
                 where = changeType.all;
                 pictureBox1.Cursor = Cursors.SizeAll;
             }
         }
         else
         {
             where = changeType.all;
             pictureBox1.Cursor = Cursors.SizeAll;
         }
     }
     return(where);
 }
Exemple #6
0
 private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
 {
     changeing          = false;
     where              = changeType.none;
     pictureBox1.Cursor = Cursors.Default;
 }