日期:2011-06-14 浏览次数:20483 次
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.Drawing.Imaging;
public partial class Default5 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.Pic();
}
private void Pic()
{
//测试数据
DataTable table = new DataTable("Data");
DataRow Dr;
DataColumn Dc = new DataColumn("ID",Type.GetType("System.Int32"));
DataColumn Dc2 = new DataColumn("Num",Type.GetType("System.Int32"));
DataColumn Dc3 = new DataColumn("name", Type.GetType("System.String"));
table.Columns.Add(Dc);
table.Columns.Add(Dc2);
table.Columns.Add(Dc3);
Random rnd=new Random();
for (int n = 0; n < 61; n++)
{
Dr = table.NewRow();
Dr[0] = n;
Dr[1] = rnd.Next(10, 140);
Dr[2] = n.ToString();
table.Rows.Add(Dr);
}
//画图参数
int BG_Width = 450;
int BG_Height = 180;
int Pic_Width = 450;
int Pic_Height = 180;
int pic_X = 6;
int pic_H = 1;
int pic_tr=5;
int pic_td = 12;
Rectangle rec = new Rectangle(50, 15, 360, 150);
Pen Pic_Bolder = new Pen(Color.Black, 1);
Pen Pic_line = new Pen(Color.Gray, 1);
Pen Pic_Data = new Pen(Color.Red,2);
SolidBrush brusth = new SolidBrush(Color.Blue);
Point[] DataPt = new Point[table.Rows.Count];
int x;
int y;
for (int n = 0; n < table.Rows.Count; n++)
{
Dr=table.Rows[n];
x=(int)Dr[0] * pic_X + rec.X;
y=(int)Dr[1] * pic_H + rec.Y;
DataPt[n] = new Point(x,y);
}
&