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