梦醒三分,执着疯子
没有什么不可以!

生成以上图形的部分代码如下:
   conn=new SqlConnection(connStr);
   conn.Open();

   DataSet ds  = new DataSet();
   SqlDataAdapter adapter=new SqlDataAdapter();
   adapter.SelectCommand=new SqlCommand();
   adapter.SelectCommand.Connection=conn;
   adapter.SelectCommand.CommandText="my_showDynPic";
   adapter.SelectCommand.CommandType=CommandType.StoredProcedure;

   adapter.Fill(ds, "Document");
   num=ds.Tables["Document"].Rows.Count;

   strPoint = new PointF(3, 79);
   myBitmap = new Bitmap(810, num * 20 + 120);
   myGpics=Graphics.FromImage(myBitmap);
   myGpics.Clear(Color.White);
   //头部
   myGpics.DrawString(" 工厂生产实时动态图", headFont, Brushes.Black, new PointF(350, 5));
   myGpics.DrawString(" 总计:" + num.ToString() + "张单", myFont, Brushes.Black, new PointF(10, 30));
   myGpics.DrawString(" 今日:" + DateTime.Now.ToString(), myFont, Brushes.Black, new PointF(140, 30));

   myGpics.DrawLine(Pens.Red, 380, 28, 540, 28);
   myGpics.DrawLine(Pens.Red, 380, 32, 540, 32);
   //阶段颜色提示
   myGpics.FillRectangle(new SolidBrush(Color.Green), 680, 5, 30, 10);
   myGpics.DrawRectangle(Pens.GreenYellow, 680, 5, 30, 10);
   myGpics.DrawString("表示生产正常", contFont, Brushes.Black, new PointF(715, 5));

   myGpics.FillRectangle(new SolidBrush(Color.Orange), 680, 20, 30, 10);
   myGpics.DrawRectangle(Pens.GreenYellow, 680, 20, 30, 10);
   myGpics.DrawString("表示生产提前", contFont, Brushes.Black, new PointF(715, 20));

   myGpics.FillRectangle(new SolidBrush(Color.Red), 680, 35, 30, 10);
   myGpics.DrawRectangle(Pens.GreenYellow, 680, 35, 30, 10);
   myGpics.DrawString("表示生产延迟", contFont, Brushes.Black, new PointF(715, 35));
   //尾部
   myGpics.DrawString("*********工厂 ", contFont, Brushes.Black, new PointF(650, num * 20 + 85));
   myGpics.DrawString(" 网络管理中心 ", contFont, Brushes.Black, new PointF(650, num * 20 + 100));
   //表头
   myGpics.FillRectangle(new SolidBrush(Color.Black), x1, headY - 2, x3, 20);
   myGpics.DrawRectangle(Pens.Gray, x1, headY - 2, x3, 20);
   myGpics.DrawString("流水号", myFont, Brushes.White, new PointF(x1+3, headY));

   myGpics.FillRectangle(new SolidBrush(Color.Black), x3+5, headY - 2, x6, 20);
   myGpics.DrawRectangle(Pens.Gray, x3+5, headY - 2, x6, 20);
   myGpics.DrawString("客户专卖店名称", myFont, Brushes.White, new PointF(x3+x2+4, headY));

   myGpics.FillRectangle(new SolidBrush(Color.Black), x6+x3+6, headY - 2, x5, 20);
   myGpics.DrawRectangle(Pens.Gray, x6+x3+6, headY - 2, x5, 20);
   myGpics.DrawString("备注", myFont, Brushes.White, new PointF(x6+x3+33, headY));

   myGpics.FillRectangle(new SolidBrush(Color.Black), x6+x5+x3+7, headY - 2, x7, 20);
   myGpics.DrawRectangle(Pens.Gray,  x6+x5+x3+7, headY - 2, x7, 20);
   myGpics.DrawString("该客户货柜目前正生产到", myFont, Brushes.White, new PointF( x6+x5+x3+14, headY));
   myGpics.DrawString("↓", headFont, Brushes.Red, new PointF(x6+x7+x5+x3+5, headY));

   myGpics.FillRectangle(new SolidBrush(Color.Black), x6+x7+x5+x3+8, headY - 2, x2, 20);
   myGpics.DrawRectangle(Pens.Gray, x6+x7+x5+x3+8, headY - 2, x2, 20);
   myGpics.DrawString("柜数", myFont, Brushes.White, new PointF(x6+x7+x5+x3+13, headY));

   myGpics.FillRectangle(new SolidBrush(Color.Black), 639, headY - 2, x4, 20);
   myGpics.DrawRectangle(Pens.Gray, 639, headY - 2, x4, 20);
   myGpics.DrawString("出货日期",myFont, Brushes.White, new PointF(644, headY));

   myGpics.FillRectangle(new SolidBrush(Color.Black), 725, headY - 2, x4, 20);
   myGpics.DrawRectangle(Pens.Gray, 725, headY - 2, x4, 20);
   myGpics.DrawString("接单日期", myFont, Brushes.White, new PointF(732, headY));
   ......

posted on 2007-04-06 10:54  Jacker.W  阅读(279)  评论(0编辑  收藏  举报