//绘制图形
        private string  My_Draw()
        {
            Bitmap bmap = new Bitmap(200, 200);
            Graphics g = Graphics.FromImage(bmap);
            Color c = new Color(            );
            c = Color.DarkViolet;
            Pen p=new Pen (c);
            g.DrawLine(p, new Point(0, 0), new Point(200, 200));
            string filepath = MapPath ("../img/tem1.gif");
            bmap.Save(filepath,System.Drawing .Imaging.ImageFormat .Gif );
            return filepath;
        } 然后让显示在 image控件中,
            //尝试绘图
            
            this.Image1.ImageUrl = My_Draw();
            this.Image1.Visible = true; 怎么显示不出来呢

解决方案 »

  1.   

    断点看看 My_Draw() 返回的是什么   
      

  2.   

    看看路径是不是对,还有就是你的那个返回值如何?
    难道没有权限。
    可以打开chromen的开发者工作中的网络看看你的页面加载的时候,都去取了哪些资源?
      

  3.   


    this.Image1.ImageUrl = "H:\\C#2010 Web\\SubeGrade\\SubGrade\\SubGrade\\img\\tem1.GIF"
      

  4.   

    直接返回“../img/tem1.gif”  要绝对路径干嘛
      

  5.   

    我觉得这个跟路径有什么关系嘛?路径是你自己写的,关键是这个图片存在不,你try catch 一下save方法是否成功,如果不成功,你的路径还不是照样返回,你还不是照样显示不出来
      

  6.   

    问题已经解决了:感谢各位。 1. 首先是,保存的时候用绝对路径, MapPath ("../img/tem1.gif");
    2. 取图片的时候要用相对路径  "../img/tem1.gif"
    就是这样的。 是各位的提醒才搞定的,非常之感谢。我取数据库文件的时候用绝对路径,是正确的。