Digital clock
The digital clock is a control dedicated to time display. In many scenarios, we need to display the time. This control will automatically display according to the system time.
How to use
- Double-click to open the UI file
- Find the
digital clock
control in the control set on the right - Left-click the
digital clock
control and hold it, then drag it to any position, release the left button, and you can see the digital clock control. Select the digital clock control just generated, in the property bar on the right side of the editor, you can modify its property content, mainly modify the following five properties.
- Clock display format This attribute sets the display format of the time, you can choose a 24-hour system or a 12-hour system, and control whether the seconds are displayed.
- Whether it beating
This attribute controls whether the
:
in the clock is static or beating. - Clock color This attribute sets the color display of the clock text.
- font size The text size of the attribute digital clock
- Special character set settings
We know that, according to the definition of asc code, there is a correspondence between
character char
andinteger int
. For example, the asc code of the character0
is48
. The special character set is a function of mapping the asc code to the picture. After setting this function, when we display a string, the system will try to map each character in the string to a specified picture, and finally display a string of pictures on the screen. For specific usage, please refer to Use of special character sets.
Save, download and debug, after running, you can see the effect.
- If you want to modify the time, you can refer to the System Time document to modify.
Sample code
Refer to the DigitalClockDemo project in Sample Code