Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to manually control the flicker state in VB language

Shulou Source: shulou.com Published: 2022-06-01 03:00:55 09月16日 Update

This article mainly shows you "VB language how to manually control flicker state", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "VB language how to manually control flicker state" this article.

First, manually control the flicker state

Let's simply implement a Mini Program first.

Set whether the text flashes by controlling the enable property of the timer control.

If the test button text is "stop", then set the button text to "flashing".

If the detect button text is flashing, then set the button text to stop.

Program effect 1

Program effect 2

The program interface contains controls: 1.timer1 clock control. 2.label1 label control. 3.command1 button control. The program interface is designed as follows:

Interface design

The setting properties of the clock control:

Code for the button:

If Command2.Caption = "stop" Then Timer1.Enabled = False Command2.Caption = "flashing" Else Timer1.Enabled = True Command2.Caption = "stop" End If

Clock control timer1 source code:

'Control whether to flash If Label1.Visible = True Then Label1.Visible = FalseElse Label1.Visible = TrueEnd If

Randomize

Control color change Label1.ForeColor = RGB (Int (256x Rnd), Int (256x Rnd), Int (256x Rnd)) the logic thought of program control: control whether the clock control is enabled by judging the text on the button, and insert the switch of the button text in the code logic.

Through the above procedure, we can see that the color control is carried out in the program. We control the random discoloration of our text through the rgb function and rnd random number, which will look very beautiful. So, how should random numbers be used?

Second, the main points of random number knowledge.

The random number keyword is rnd, which represents a range of 0 to 1, including 0, not 1. We use an expression to express it as 0

Tags: Controls buttons controls text programs ranges random numbers functions results manual state between integers clocks languages code content interfaces knowledge articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi OPPO Reno macOS MariaDB Linux