标签:默认 停止 drag 分享 com 设置 val 定时器 object
最前面的话:Smobiler是一个在VS环境中使用.Net语言来开发APP的开发平台,也许比Xamarin更方便
我们要实现上图中的效果,需要如下的操作:
VB:
Private Sub timer1_Tick(sender As Object, e As EventArgs) Handles timer1.Tick
Me.TextBox1.Text = (Convert.ToInt32(Me.textBox1.Text.ToString()) - 1).ToString()
End Sub
C#:
private void timer1_Tick(object sender, EventArgs e)
{
this.textBox1.Text =(Convert.ToInt32(this.textBox1.Text.ToString()) -1).ToString();
}
注:调用Timer控件
VB:
Private Sub textBox1_TextChanged(sender As Object, e As EventArgs) Handles textBox1.TextChanged
If Me.textBox1.Text = "0" Then
timer1.Stop()
Else
timer1.Start()
End If
End Sub
C#:
private void textBox1_TextChanged(object sender, EventArgs e)
{
if(this.textBox1.Text =="0")
{
timer1.Stop();
}
else
{
timer1.Start();
}
}
注:判断条件来选择开始定时器还是停止定时器
VB:
Private Sub button1_Click(sender As Object, e As EventArgs) Handles button1.Click
Me.textBox1.Text = "60"
End Sub
C#:
private void button1_Click(object sender, EventArgs e)
{
this.textBox1.Text ="60";
}
触发Tick事件的间隔时间,以秒为单位,默认设置为“1”,即间隔时间为1秒,见下图;
.Net语言 APP开发平台——Smobiler学习日志:如何快速实现Timer计时功能
标签:默认 停止 drag 分享 com 设置 val 定时器 object
原文地址:http://www.cnblogs.com/amanda112/p/6296000.html