GDI+ 绘图紧急求助
http://www38.websamba.com/hz891/images/line.jpg
http://www38.websamba.com/hz891/images/bar.jpg
上面的两张图片是利用GDI+绘制的,但是图片效果朦胧不清,不知问题何在,现贴出代码,望诸位高手赐教解决:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Microsoft.Web.UI.WebControls;
using OceanSoft.Pantheon.DAO;
using KMP50._2052.Aspx.Common_Class;
using System.IO;
using System.Diagnostics;
namespace KMP50._2052.Aspx.WJ_Collect.Aspx
{
/// <summary>
/// DataChart 的摘要说明。
/// </summary>
public class DataChart : System.Web.UI.Page
{
protected System.Web.UI.WebControls.RadioButton rdCompany;
protected System.Web.UI.WebControls.Image Image1;
protected System.Web.UI.WebControls.DropDownList ddlYear;
protected System.Web.UI.WebControls.DropDownList ddlMonth;
protected System.Web.UI.WebControls.DropDownList ddlCompany;
protected System.Web.UI.WebControls.RadioButton rdDistrict;
protected Microsoft.Web.UI.WebControls.Toolbar tlbAddressList;
WJ_EnterpriseSummaryCtl WJESCtl=new WJ_EnterpriseSummaryCtl();
WJ_EnterpriseSummaryEnt WJESEnt=new WJ_EnterpriseSummaryEnt();
protected System.Web.UI.WebControls.Image Image2;
DataSet ds;
private Bitmap b ;
private Graphics g ;
int width=0,height=0; //画布宽度和高度
float x_width=0,y_height=0; //x轴和y轴长度
float X0=0,Y0=0; //x轴和y轴起始点
float X1=0,Y1=0,X2=0,Y2=0; //两组坐标
float xScale=0; //x轴刻度长度
float yScale=0; //y轴刻度长度
float yScaleValue=0; //y轴单位刻度值
int year=0; //年数:1年/2年/3年
int month=0; //月数:1个月,2个月,......12个月
int ny=5;//将y轴均分5份
string company= " ",companyGuid= " "; //企业名称,企业Guid
public DataChart()
{
width=500;
height=350;
x_width=width*7/10;
y_height=height*7/10;
b = new Bitmap(width,height);
g = Graphics.FromImage ( b ) ;
//呈现质量设置为高
g.SmoothingMode = SmoothingMode.HighQuality;
//关联插补模式设置为高质量双三次插值法
g.InterpolationMode=InterpolationMode.HighQualityBicubic;
//设置合成图像的呈现质量为高
g.CompositingQuality=CompositingQuality.HighQuality;
//设置坐标度量单位为像素
g.PageUnit=GraphicsUnit.Pixel;
//设置像素偏移质量为高
g.PixelOffsetMode=PixelOffsetMode.HighQuality;
}
~DataChart()
{
g.Dispose();
b.Dispose();
System.GC.Collect();
}
------解决方案--------------------好长帮顶!
------解决方案--------------------不是画的不清
是保存成jpg时失真
b.Save(Server.MapPath(path),System.Drawing.Imaging.ImageFormat.Jpeg);
------解决方案--------------------你不保存成jpg,先保存成bitmap看看
如果还是模糊
可能真是绘出的原图的确模糊(可能性比较小)