if (pictureBox1.Image != null)
            {
                System.Drawing.Bitmap map = new Bitmap(pictureBox1.Image);
                Graphics g = Graphics.FromImage(map);
                Pen pen = new Pen(Color.Red, 10);
                int width = pictureBox1.Width;
                int height = pictureBox1.Height;
                Rectangle WeiXingRe = new Rectangle((int)(width * 0.28), (int)(height * 0.27), (int)(width * 0.35), (int)(height * 0.05));
                g.DrawRectangle(pen, WeiXingRe);
            }
            else
            {
                MessageBox.Show("请选择图片");
            }这个代码怎么绘制不出图形呢?

解决方案 »

  1.   

    回答送女友啦if(anyOneAnswerMe)
    SendGirlToHe();
    else
    MessageBox.Show("快回答我的问题,送女友哦");
      

  2.   

    把你的方法写到 paint事件里就行
      

  3.   

    1,你应该把bmp重新赋值给pictureBox,要不然pictureBox里面还是以前的图像,当然看不出来了。
    2,你可以把原始图像保存一个副本,如果你在上面画了矩形框,那么生成另外一张图像,如果你要撤销矩形框,那么再把原始图像赋值过来就行了