在VB.NET中闪烁标签 [英] Blinking Label in VB.NET

查看:244
本文介绍了在VB.NET中闪烁标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

My Boss问他想要一个Blinking标签,所以我确定我会在这里使用一个计时器。



可以有人给我一个代码来设置标签可见为true并使用计时器将标签再次设置为false(反之亦然)使用计时器



这是紧急请帮助



sir sergev

My Boss ask the he wants to have a Blinking label so im sure that i will use here a timer.

can someone give me a code that will set the label visible to true and set the label visible again to false every second (vice versa)using a timer

this is urgent please help

sir sergev

推荐答案

1)在表单中添加一个计时器对象(我相信它位于工具箱中的组件下)

2)将其间隔设置为1000(以毫秒为单位

3)向其Tick事件添加事件处理程序

4)在事件处理程序中添加类似于:



1) Add a timer object to your form (I believe it is under "Components" in the toolbox)
2) Set its interval to 1000 (it is in milliseconds
3) Add an event handler to its "Tick" event
4) In the event handler put something similar to:

mylabel.Visible = Not mylabel.Visible





5)将计时器设置为启用



应该做的工作。



或者你可以制作一个自定义控件MyBlinkingLabel为它添加一个标签和一个计时器,这样它就是全部封装在一个地方。



或者你可以在代码中执行定时器控制位。



那里有多种选择。



5) Set the timer to enabled

That should do the job.

Or you could make a custom control "MyBlinkingLabel" add a label and a timer to that so that it is all encapsulated in one place.

Or you could do the timer control bits in code.

There are various options available to you.


这篇关于在VB.NET中闪烁标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆