做项目,但出于某种原因周期没有工作

发布于 2025-01-28 06:43:24 字数 971 浏览 1 评论 0原文

我正在排队绘制矩形,每回合都应该删除一个矩形,直到我不小于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;
               
            }
        }
    }
}

form1

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;
               
            }
        }
    }
}

form1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文