关于vb.netcolor的信息

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

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

成都创新互联公司2013年成立,是专业互联网技术服务公司,拥有项目成都网站建设、成都做网站网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元毕节做网站,已为上家服务,为毕节各地企业和个人服务,联系电话:18980820575

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中,如何获取Graphics中某一指定点(像素)的颜色值?(VB语言)

要使用GetPixel函数来取得像素的颜色值,代码如下:

1

2

3

4

5

private void button1_Click(object sender, EventArgs e)

{

Color color = new Bitmap(pictureBox1.Image).GetPixel(10, 10);

MessageBox.Show(color.ToString());

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

c#/vb.net如何通过反射获得颜色名称(字符串)对应的颜色(Color类型)?

public Color col(string colorName)

{

Type colorType = typeof(Color);

PropertyInfo info = colorType.GetProperty(colorName, BindingFlags.Public | BindingFlags.Static);

if (infos == null)

{

//throw Exception

}

return(Color)info.GetValue(null, null);

}

是这个意思么?输入“Red”, 返回Color.Red 区分大小写


当前题目:关于vb.netcolor的信息
转载来于:http://scyanting.com/article/dosgdph.html