做项目,但出于某种原因周期没有工作
我正在排队绘制矩形,每回合都应该删除一个矩形,直到我不小于1,但是由于某种原因,它只删除一个矩形,这就是我在做什么错?
namespace WindowsFormsApp3
{
public partial class Form1 : Form
{
int i;
int j;
int h = 0;
int w = 0;
int x = 0;
int y = 0;
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
Graphics gr = panel1.CreateGraphics();
{
for (i = 5; i > 1; i--)
{
gr.DrawRectangle(Pens.Black, x, 70 + y, 60 + h, 60 + w);
x += 70;
}
x = 0;
y += 70;
}
}
}
}
i'm drawing rectangles in line, and every turn it's supposed to delete one rectangles every turn, until i wont be less than 1, but for some reason it's only deleting one rectangle and thats it, what am i doing wrong?
namespace WindowsFormsApp3
{
public partial class Form1 : Form
{
int i;
int j;
int h = 0;
int w = 0;
int x = 0;
int y = 0;
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
Graphics gr = panel1.CreateGraphics();
{
for (i = 5; i > 1; i--)
{
gr.DrawRectangle(Pens.Black, x, 70 + y, 60 + h, 60 + w);
x += 70;
}
x = 0;
y += 70;
}
}
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论