Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to manually control the flicker state in VB language

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report