
private int x
private int y
private static int count = 0
初始化函数
public Form1()
{
InitializeComponent()
x = this.pictureBox1.Location.X
y = this.pictureBox1.Location.Y
}
时钟函数
private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
if (count == 4) count = 0
int signX,signY = 1
if (count == 0 || count == 1) signX = 1
else signX = -1
if (count == 0 || count == 3) signY = -1
else signY = 1
this.Controls.Remove(this.pictureBox1)
pictureBox1.Location = new Point(x+10*signX,y+10*signY)
this.Controls.Add(pictureBox1)
count ++
}
这里的循环只是团睁一个绕原先点的塌旅岁矩形移动
写过VB没有?一样的档皮谨东西。写一个窗体程序很简单,写一个性能,美观,都优秀的程序,那就要花时间去研行基究了。具体说来没有什么捷径,不停的学习握闭,不停的摸索。到后来就是水到渠成的事情。欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)