| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 948 人关注过本帖
标题:c#计时器问题???
只看楼主 加入收藏
冲冲走过
Rank: 2
等 级:论坛游民
帖 子:69
专家分:72
注 册:2011-10-2
结帖率:91.67%
收藏
已结贴  问题点数:4 回复次数:2 
c#计时器问题???
private void Form1_Load(object sender, EventArgs e)
        {
            timer1.Start();

            timer2.Start();
        }
        string T = "苟利国家生死以," + "\r\n" + "岂因祸福避趋之。"; int i = 0;
        private void timer1_Tick(object sender, EventArgs e)
        {
            string s;
            s = T.Substring(i, 1);
            textBox1.Text += s;
            label1.Text = T.Length + "----" + i.ToString();
            textBox1.SelectionStart = textBox1.TextLength;
            i++;
            if (i > T.Length-1)
            {
                i = 0;
                s = "";
                textBox1.Text = "";
               
                timer1.Stop();
                timer2.Start();

            
            }





        }

        private void timer2_Tick(object sender, EventArgs e)
        {

            timer2.Stop();
            timer1.Start();

      

        }

    }
}

 结果是最后一个句号显示不出来,求高手解决????!!!

 
搜索更多相关主题的帖子: 计时器 private 
2011-11-17 13:56
jedypjd
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:蒙面侠
威 望:9
帖 子:1096
专家分:4969
注 册:2009-7-27
收藏
得分:0 
看不明白第二个计时器是干什么用的

天涯无岁月,歧路有风尘,百年浑似醉,是非一片云
2011-11-17 14:17
yhlvht
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:36
帖 子:707
专家分:4405
注 册:2011-9-30
收藏
得分:4 
        private void timer1_Tick(object sender, EventArgs e)
        {
            string s;
            if (i < T.Length)
            {
                s = T.Substring(i, 1);
                textBox1.Text += s;
                label1.Text = T.Length + "----" + i.ToString();
                textBox1.SelectionStart = textBox1.TextLength;
            }
            i++;
            if (i > T.Length)
            {
                i = 0;
                s = "";
               
                textBox1.Text = "";

                timer1.Stop();
                timer2.Start();
            }
        }
2011-11-17 14:27
快速回复:c#计时器问题???
数据加载中...
 
   



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

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