日期:2014-05-17  浏览次数:20873 次

怎么实现单击鼠标图片变小双击鼠标图片变大啊~~~~
本帖最后由 heyheyyoyo 于 2012-12-16 19:28:55 编辑
用到了picturebox控件~~
想要实现单击鼠标图片变小
双击鼠标图片变大(当然是击图片啦~)
还有就是点击右键能实现图片移动~

可是。。。有点困难呢对我来说。。。

所以小妹又来求大神相助啦~下面附上我的零零乱乱的代码。。。TAT
  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)
        {