我想让我的小行星移动 [英] I want my asteroid to move
本文介绍了我想让我的小行星移动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望我的小行星移动!但我有一个专门的课程。我想让它在那个班级内移动(如果可能的话)。当我将小行星添加到Screen类时,我希望看到一些动作。 ORrrrr以某种方式将计时器类添加到Screen类????并以某种方式更新小行星类的定时器? - 怎么做?
I want my asteroid to move! But I have a class dedicated for it. I want it to move inside that class(if possible). When I add the asteroid to Screen class, I want to see some action. ORrrrr Add somehow the timer class into Screen class???? and update somehow the timer from asteroid class?? - How to do it?
//Asteroid Class
void aTimer_Elapsed(object sender, ElapsedEventArgs e)
{
x1 = y1+=11;
}
public void New(object sender, System.Windows.Forms.PaintEventArgs e)
{
e.Graphics.DrawLine(new Pen(Brushes.Black), x1, y1, x2, y2);
}
//Screen Class
private void Screen_Paint(object sender, PaintEventArgs e)
{
asteroid.New(sender, e); // is rendering fine !!!
}
谢谢。
我尝试了什么:
------------------------- -------------------------------------------------- ---
Thank you.
What I have tried:
------------------------------------------------------------------------------
推荐答案
我认为你需要研究事件,这是一个例子:最简单的C#事件示例可想象的 [ ^ ]
I think you need to study events, here is an example: The Simplest C# Events Example Imaginable[^]
这篇关于我想让我的小行星移动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文