vb.net颜色保存,vb文本颜色

Vb.net2010字体颜色问题?

这个问题的本质就是随机二字,无论c/s还是b/s里面的label1 ,只要随机设置字体颜色属性即可。而相关属性我相信您肯定知道,关键是怎样随机。vb.net里面有一个随机函数,只要利用该随机函数,随机生成相应的颜色即可,然后把随机颜色赋值给label的属性

成都创新互联10多年成都定制网站服务;为您提供网站建设,网站制作,网页设计及高端网站定制服务,成都定制网站及推广,对成都工商代办等多个方面拥有丰富的网站设计经验的网站建设公司。

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

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

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.net将Label1的文字颜色设置保存到硬盘,程序下次启动时读取!!

添加应用程序配置文件

appconfig

把这些信息放到xml里

?xml version="1.0" encoding="utf-8" ?

configuration

appSections

section name="labelcolor" value="#333333"/

/configuration

ConfigurationSettings.AppSettings["labelcolor"];读取#333333

VB.NET,Me.BackColor = Color.Red设置成红色后,怎么恢复原来的颜色?

用一个变量存储原来的颜色啊

dim a as intger=Me.BackColor

Me.BackColor=a

vb.net编写程序时如何存储设置参数?

比较专业的做法是在项目中添加微软的Application Settings类,详细帮助文档:

使用极其简单,假设在settings1.settings设置一个项目,名称:IP,类型:String,范围:用户,值:192.168.1.1

调用:Dim sIP As String = setting.IP

获取缺省值:Dim sIP As String = Settings1.Default.IP

保存: setting.IP = "192.168.1.30" : setting.Save()

vb.net 如何读取ini文件定义的ForeColor颜色值

你好,我不知道你是用什么方法保存的,不过.net里的color有一个方法是Color.FromArgb 你可以这么做,dim c as color=richtextbox1.ForeColor dim colorstring as string=c.ToArgb().ToString colorstring就是颜色的值(字符串)再把colorstring保存到ini文件加载颜色的时候,从ini里读取colorstring 具体是:dim RtextColor as color=Color.FromArgb(cint(colorstring))richtextbox1.ForeColor =RtextColor


名称栏目:vb.net颜色保存,vb文本颜色
当前路径:http://lszwz.com/article/dscipjg.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款