111,125
社区成员
发帖
与我相关
我的任务
分享
private void pictureBox1_MouseMove(object sender,System.Windows.Forms.MouseEventArgs e)
{
this.Text=String.Concat("当前鼠标位置:","(",e.X.ToString(),",",e.Y.ToString(),")");
/* if (e.Button == MouseButtons.Left)
{
pictureBox1.Location = new Point(Cursor.Position.X - (p.X - cp.X), Cursor.Position.Y - (p.Y - cp.Y));
}*/
}
private void pictureBox1_MouseHover(object sender, System.EventArgs e)
{
this.Text = "单击左键放大图片,单击右键缩小图片,用光标移动图片";
}
private void pictureBox1_MouseLeave(object sender, System.EventArgs e)
{
this.Text = "作品信息查询";
}
private void pictureBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
/* p.X = Cursor.Position.X;
p.Y = Cursor.Position.Y;
cp.X = pictureBox1.Location.X;
cp.Y = pictureBox1.Location.Y;*/
//double scale = 1.0;
if (e.Button == MouseButtons.Left) scale = 0.9;
//if (e.Button == MouseDoubleClick) scale = 0.9;
pictureBox1.Size = new System.Drawing.Size((int)(pictureBox1.Width * scale), (int)(pictureBox1.Height * scale));
}
double scale = 1.0;
private void pictureBox1_DoubleClick(object sender, EventArgs e)
{
scale = 1.1;
}
/// <summary>
/// 鼠标单击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
{
//判断是否是按的鼠标左键 避免按到右键误操作
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
//如果当前图片框的宽高大于初始的宽高 说明已放大 则还原初始大小
if (this.pictureBox1.Width > this.with && this.pictureBox1.Height > this.height)
{
this.pictureBox1.Width = this.with;
this.pictureBox1.Height = this.height;
}
}
}
/// <summary>
/// 鼠标双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void pictureBox1_MouseDoubleClick(object sender, MouseEventArgs e)
{
//判断是否是按的鼠标左键
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
this.pictureBox1.Width += 50;
this.pictureBox1.Height += 50;
}
}
姑娘 冷静!!