请问怎么绘制图线啊
怎么写代码
private void pictureBox1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
float x;
float y;
x=this.pictureBox1.Size.Width -500;
y=this.pictureBox1.Size.Height-20;
Graphics g=e.Graphics;
Pen p1=new Pen(Color.Red);
Pen p2=new Pen(Color.Blue,10);
Pen p3=new Pen(Color.Blue);
g.TranslateTransform(x,y);
//画x轴
g.DrawLine(p1,0,-200,0,0);
//画y轴
g.DrawLine(p1,0,0,500,0);
g.DrawLine(p3,15,-70,15,0);
g.DrawLine(p3,55,-70,55,0);
g.DrawLine(p2,15,-50,15,-30);
g.DrawLine(p2,55,-50,55,-30);
SolidBrush mySolidBrush=new SolidBrush(Color.Blue);
//画线
g.DrawLine(new Pen(Color.Red),95,-100,95,-10);
g.DrawLine(new Pen(Color.Red),135,-100,135,-10);
//画矩形
g.DrawRectangle(new Pen(Color.Red),90,-80,10,20);
g.DrawRectangle(new Pen(Color.Red),130,-80,10,20);
Pen p=new Pen(Color.Red);
Font f=new Font("Arial",8);
System.Drawing.SolidBrush br=new SolidBrush(Color.Red);
for(int i=30;i<500;i=i+30)
{
g.DrawLine(p,new Point(i,0),new Point(i,3));
g.DrawString(i.ToString(),f,br,i-7,0);
}
}