| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 445 人关注过本帖
标题:然后在button3中设置往返
只看楼主 加入收藏
黎珍利
Rank: 1
等 级:新手上路
帖 子:20
专家分:9
注 册:2012-3-7
结帖率:71.43%
收藏
已结贴  问题点数:20 回复次数:2 
然后在button3中设置往返
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

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

        private void button1_Click(object sender, EventArgs e)
        {
            label1.Location = new Point(label1.Location.X + 10, label1.Location.Y);
        }

        private void button2_Click(object sender, EventArgs e)
        {
            int i = 0;
            for (i = 0; i < 500; i++)
                label1.Location = new Point(label1.Location.X + 5, label1.Location.Y);
        }
 private void button3_Click(object sender, EventArgs e)
        {

        }

        private void button4_Click(object sender, EventArgs e)
        {
            label1.Location = new Point(0, 0);



        }

        
        
    }
}
搜索更多相关主题的帖子: void private public 
2012-03-07 22:07
tanghuawei
Rank: 4
来 自:美丽的湖南
等 级:业余侠客
威 望:3
帖 子:531
专家分:220
注 册:2006-3-16
收藏
得分:20 
你在button3里写入如下代码,不知道是否是你想要的效果:
程序代码:
while (i < 500)
            {               
                label1.Location = new Point(label1.Location.X + 5, label1.Location.Y);               
                i++;
            }
            while (i > 0)
            {
                label1.Location = new Point(label1.Location.X - 5, label1.Location.Y);
                i--;
            }


汽车尾气检测网络系统QQ:357766186__MSN:MSNTHW19850316@
2012-03-08 12:06
黎珍利
Rank: 1
等 级:新手上路
帖 子:20
专家分:9
注 册:2012-3-7
收藏
得分:0 
回复 2楼 tanghuawei
谢谢啊
2012-03-10 17:12
快速回复:然后在button3中设置往返
数据加载中...
 
   



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

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