标题:如何让lable控件沿窗体四周运动一圈
取消只看楼主
黎珍利
Rank: 1
等 级:新手上路
帖 子:20
专家分:9
注 册:2012-3-7
结帖率:71.43%
已结贴  问题点数:20 回复次数:0 
如何让lable控件沿窗体四周运动一圈
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace yundng
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }


        private void button1_Click(object sender, EventArgs e)
        {
            double myWidth = this.ClientSize.Width;
            double myHeight = this.ClientSize.Height;
            int j = 0;
            int k = 0;
            while (j<myWidth)
            {
                label1.Location = new Point(label1.Location.X + 1, label1.Location.Y);
                j++;
            }
            while (k<myHeight)
            {
                label1.Location = new Point(label1.Location.X, label1.Location.Y +1);
                k++;
            }
            while (j>0)
            {
                label1.Location = new Point(label1.Location.X - 1, label1.Location.Y);
                j--;
            }
            while (k > 0)
            {
                label1.Location = new Point(label1.Location.X, label1.Location.Y - 1);
                k--;
            }
        }

  }
    这样写的话,代码错在哪?
搜索更多相关主题的帖子: double class private public 如何 
2012-03-14 11:15



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-363132-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.681224 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved