快上网专注成都网站设计 成都网站制作 成都网站建设
成都网站建设公司服务热线:028-86922220

网站建设知识

十年网站开发经验 + 多家企业客户 + 靠谱的建站团队

量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决

vb点虐 发光文字 vb显示文字代码

VB.NET如何显示多种颜色的一段文本?

Label控件是没有办法实现多种颜色的文字的,只能用RichTextBox来实现,而且你的自定义格式字符串也没有结尾的,这样很不好,至少也要red红色字/redyellow黄色字/yellow,而且实现也很麻烦的,下面的代码我没有检测正确性,有错误的自己改一改吧

成都创新互联公司客户idc服务中心,提供绵阳服务器托管、成都服务器、成都主机托管、成都双线服务器等业务的一站式服务。通过各地的服务中心,我们向成都用户提供优质廉价的产品以及开放、透明、稳定、高性价比的服务,资深网络工程师在机房提供7*24小时标准级技术保障。

Dim colortag() as string

dim colors() as color

const txt as string="red红色字/redyellow黄色字/yellow"

private sub Form_Load(object sender,eventargs e)handles mybase.load

colortag(0)="red":Colortag(1)="yellow"

colors(0)=color.red:colors(1)=color.yellow

richtextbox1.text=txt

for i as integer=0 to colortag.lenght-1

dim tag as string="" colortag(i) ""

dim endtag as string="/" colortag(i) ""

dim find as integer=1

do

find=instr(find,txt,tag)+tag.lenght

if(find0)then

dim find1 as integer=instr(find,txt,endtag)

richtextbox1.SelectionStart=find

richtextbox1.selectionlenght=find1-find

richtextbox1.selectioncolor=colors(i)

find=find1

else

exit do

end if

loop

next

end sub

vb点虐 高亮度显示文本

选中就是高亮,首先得到你找到的文本字符的起始位置和长度,然后

TextBox.Select(start,length)

TextBox.SelectionStart = start

TextBox.SelectionLength = length

[VB.NET]如何用VB在窗体中实现闪烁文字

通过使用VB的Timer控件,程序员可以轻松的在窗体上实现闪烁文字的效果。本文将演示如何为Label控件加上闪烁效果,这种方法同样适用于其它多种控件。以下代码可以完成检验ForeColor属性的任务: Private Sub Timer1_Timer() If Label1.ForeColor = Label1.BackColor Then Label1.ForeColor = vbBlack Else Label1.ForeColor = Label1.BackColor End If End Sub 另外,你也可以让文字采用不同的颜色,比如交替采用红色和绿色: Private Sub Timer1_Timer() If Label1.ForeColor = vbRed Then Label1.ForeColor = vbGreen Else Label1.ForeColor = vbRed End If End Sub 当你停止文字闪烁时,还要确定文字的状态是可见的并且采用了合适的色彩。


新闻名称:vb点虐 发光文字 vb显示文字代码
文章路径:http://6mz.cn/article/ddsghdh.html

其他资讯