日期:2014-05-17 浏览次数:20965 次
private bool isMoving = false;
private int x, y;
private void mouseDown(object sender, MouseEventArgs e)
{
this.pictureBox1.Focus();
isMoving = true;
x = e.X;
y = e.Y;
}
private void mouseMove(object sender, MouseEventArgs e)
{
if (isMoving)
{
this.pictureBox1.Left += (e.X - x);
this.pictureBox1.Top += (e.Y - y);
}
}
private void mouseUp(object sender, MouseEventArgs e)
{
isMoving = false;
}
private void PictureBox1_MouseWheel(object sender, System.Windows.Forms.MouseEventArgs e)
{
if (e.Delta > 0)
{
pictureBox1.Width = Convert.ToInt32(pictureBox1.Width * 0.8);
pictureBox1.Height = Convert.ToInt32(pictureBox1.Height * 0.8);
}
else
{
pictureBox1.Width = Convert.ToInt32(pictureBox1.Width / 0.8);
pictureBox1.Height = Convert.ToInt32(pictureBox1.Height / 0.8);
}
}