用时间控件做动画走出轨迹的问题用drawline() 但报错,请叫各位大神
private void timer1_Tick(object sender, EventArgs e){
vz = Convert.ToDouble(textBox3.Text);
a = Convert.ToDouble(textBox4.Text);
int b = (int)(vz * Math.Sin(Math.PI / 180 * a)); //(int)表示强制转换
int c = (int)(vz * Math.Cos(Math.PI / 180 * a));
int jmkd = (int)Convert.ToDouble(textBox1.Text);//注意每次都有调用赋值
int jmgd = (int)Convert.ToDouble(textBox2.Text);
Pen blackPen = new Pen(Color.Black, 3); // 设置画笔的颜色和线条粗细
Point p1 = new Point(pictureBox1.Location.X, pictureBox1.Location.Y); //定义第一个点
Point p = new Point(pictureBox1.Location.X + b, pictureBox1.Location.Y + c);
pictureBox1.Location = p;
Point p2 = p; //定义第二个点
e.Graphics.DrawLine(blackPen, p1, p2);
if ((pictureBox1.Location.Y + 2 * pictureBox1.Size.Height) > jmgd)
{
timer1.Enabled = false ;
timer2.Enabled = true;
timer3.Enabled = false;
timer4.Enabled = false;
}
if ((pictureBox1.Location.X + pictureBox1.Size.Width ) > jmkd)
//if ((pictureBox1.Location.Y + pictureBox1.Size.Height) > )
{
timer1.Enabled = false;
timer2.Enabled = false;
timer3.Enabled = false;
timer4.Enabled = true;
}
}
为什么 e.Graphics.DrawLine(blackPen, p1, p2);这句报错说1 “System.EventArgs”不包含“Graphics”的定义,并且找不到可接受类型为“System.EventArgs”的第一个参数的扩展方法“Graphics”(是否缺少 using 指令或程序集引用?)
跪求大神能解决