天天看点

加载页面

using image = system.drawing.image;

在page_load里调用下面代码,然后直接调用这个页面的url就是生成的图片了.

image image = image.fromfile(server.mappath("~/background.png"));

            graphics g = graphics.fromimage(image);

            try

            {

                ///

                  ////操作image对象代码

                //保存图片并通过response输出流

                response.clear();

                response.contenttype = "image/png";

                image.save(response.outputstream, imageformat.png);

            }

            finally

                g.dispose();

                image.dispose();

因为aspx调用动态生成硬盘文件的话会因为缓存同一个文件名无法刷新,而动态文件名则要放硬盘,读 完了还要删除,非常麻烦,所以通过aspx输出给其他控件直接用url调用

作者:kkcat