private void PictureBox1_MouseUp(object sender, MouseEventArgs e) { Point end = Cursor.Position; // スクリーン座標で移動量を調べる Point delta = new Point(start.X - end.X, start.Y - end.Y); switch (status) { case opemode.移動: pictureBox1.Location = new Point(pictureBox1.Location.X - delta.X, pictureBox1.Location.Y - delta.Y); break; case opemode.縮小: if (currentscale > 0.3) { currentscale -= 0.03; } pictureBox1.Image = ResizeImage(originalimg, currentscale); break; case opemode.拡大: if (currentscale < 5) { currentscale += 0.03; } pictureBox1.Image = ResizeImage(originalimg, currentscale); break; } status = opemode.NOP; }
private void PictureBox1_MouseDown(object sender, MouseEventArgs e) { status = opemode.移動; start = Cursor.Position; // スクリーン座標で移動量を調べる if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift) { status = opemode.縮小; } if ((Control.ModifierKeys & Keys.Control) == Keys.Control) { status = opemode.拡大; } }