Front: Smobiler is a development platform that uses. NET language to develop apps in the VS environment, perhaps more convenient than Xamarin
First, the target style
We want to achieve the effect in the following actions:
1. Drag a Timer control, a TextBox control, a button control, a label control, and an image control to the form interface from "Smobiler components" on the toolbar
Tick events for 2.Timer controls
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.Te Xt. ToString ())-1). ToString (); }
Note: Call the Timer control
The TextChanged event of 3.TextBox
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 (); } }
Note: Determine the condition to select the start timer or stop timer
The Click event for the 4.Button control
Vb:private Sub button1_click (sender as Object, e as EventArgs) Handles button1. Click Me.textBox1.Text = "the" End Sub
C #: private void Button1_Click (object sender, EventArgs e) {this.textBox1.Text = "60"; }
5. Modify the properties of the Timer Control A.interval property
The time interval for triggering the tick event, in seconds, the default setting is "1", i.e. the interval time is 1 seconds, see;
Second, the mobile phone effect display
The effect is displayed when the button is pressed:
. NET Language app development platform--smobiler Learning log: How to quickly implement timer timer function