我用如下方式画了一张图片
Bitmap tp1 = new Bitmap(w, h);
            if (chars1.Length == w/2 * h)
            {
                for (int i = 0; i < w/2; i++)
                    for (int j = 0; j < h; j++)
                    {
                        if (chars1[(i * h + j)].ToString() == "1")
                            tp1.SetPixel(i * tableSpace, j, Color.Black);
                        else
                            tp1.SetPixel(i * tableSpace, j, Color.White);
                    }
            }
            Graphics g = System.Drawing.Graphics.FromImage(result);//新建一个画板
            g.DrawImage(tp1, new Rectangle(currentCol, currentLine, w, h));
请问我怎么去查看这张图片,不是保存

解决方案 »

  1.   

    Image img = Image.FromGraphic(g);
    this.PictureBox1.Image = img;
      

  2.   

    我的image怎么没有FromGraphic方法,⊙﹏⊙b汗
      

  3.   

    你要在哪里显示?
    那个result就是一个Image吗?
    那为什么不直接
    pictureBox1.Image = result;
      

  4.   

    this.PictureBox1.Image = result;
      

  5.   

    另外,你也可以下一个断点,在调试器里面查看。VS2008+ 的查看器可以直接看 Image 的。
      

  6.   

    这样可以显示,但是我要是再加上result.disponse()的话会报application.run(form)的错误。其中result为全局变量,static bitmap result = new bitmap(1000,2000),g也是全局的,如果result不加static在Graphics.FromImage(result)的时候会报错,说什么必须是静态的,求教高人