将String转换为COlor [英] Convert String to COlor

查看:71
本文介绍了将String转换为COlor的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我决定开始一个新线程。我有xml文件格式的输出。它看起来像这样:
这样:


< P1JoyUp>

< Top> 326< / Top>

< Left> 54< / left>

<高度> 23< /高度>

<宽度> 100< /宽度>

<可见>真< /可见>

< ForeColor>颜色[白色]< / ForeColor>

< BackColor>颜色[透明]< / BackColor>

< Font> [字体:名称= Microsoft Sans Serif,大小= 8.25,单位= 3,

GdiCharSet = 0,GdiVerticalFont = False ]< / Font>

< / P1JoyUp>


我写出来并使用数据集读取它。现在,当我阅读它时,我需要

将forecolor和backcolor字符串转换为system.drawing.something。

我需要寻找答案。 />

谢谢,

John

I decided to start a new thread. I have output in xml file format. It looks
like this:

<P1JoyUp>
<Top>326</Top>
<Left>54</Left>
<Height>23</Height>
<Width>100</Width>
<Visible>True</Visible>
<ForeColor>Color [White]</ForeColor>
<BackColor>Color [Transparent]</BackColor>
<Font>[Font: Name=Microsoft Sans Serif, Size=8.25, Units=3,
GdiCharSet=0, GdiVerticalFont=False]</Font>
</P1JoyUp>

I write it out and read it in using a data set. Now when I read it in I need
to convert the forecolor and backcolor strings to system.drawing.something.
WHere do I need to look for an answer.

Thanks,
John

推荐答案

您是否尝试过将颜色转换为颜色类?


" jcrouse" <乔********* @ comcast.net>在消息中写道

news:uT ************** @ tk2msftngp13.phx.gbl ...
Have you tried converting to a color in the color class?

"jcrouse" <jo*********@comcast.net> wrote in message
news:uT**************@tk2msftngp13.phx.gbl...
我决定开始一个新线程。我有xml文件格式的输出。
看起来像这样:

< P1JoyUp>
< Top> 326< / Top>
< Left> 54< / Left>
<高度> 23< /高度>
<宽度> 100< /宽度>
<可见>真< /可见>
< ForeColor>颜色[白色]< / ForeColor>
< BackColor>颜色[透明]< / BackColor>
<字体> [字体:名称= Microsoft Sans Serif,尺寸= 8.25,单位= 3,
GdiCharSet = 0,GdiVerticalFont = False]< / Font>
< / P1JoyUp>

我写出来并使用数据集读取它。现在,当我在I
中读取它时,需要将forecolor和backcolor字符串转换为
system.drawing.something。我需要寻找答案。

谢谢,
约翰
I decided to start a new thread. I have output in xml file format. It looks like this:

<P1JoyUp>
<Top>326</Top>
<Left>54</Left>
<Height>23</Height>
<Width>100</Width>
<Visible>True</Visible>
<ForeColor>Color [White]</ForeColor>
<BackColor>Color [Transparent]</BackColor>
<Font>[Font: Name=Microsoft Sans Serif, Size=8.25, Units=3,
GdiCharSet=0, GdiVerticalFont=False]</Font>
</P1JoyUp>

I write it out and read it in using a data set. Now when I read it in I need to convert the forecolor and backcolor strings to system.drawing.something. WHere do I need to look for an answer.

Thanks,
John



我'我正在看Color类和typeconverters,但我不理解

typedescriptor参数或他们在msdn帮助中给出的例子。


John


" Scott M." < S - *** @ nospam.nospam>在消息中写道

新闻:uW ************** @ TK2MSFTNGP09.phx.gbl ...
I''m looking at the Color class and typeconverters but I dont'' understand the
typedescriptor parameter or the example they give in the msdn help.

John

"Scott M." <s-***@nospam.nospam> wrote in message
news:uW**************@TK2MSFTNGP09.phx.gbl...
你试过转换为颜色类中的颜色?

" jcrouse" <乔********* @ comcast.net>在消息中写道
新闻:uT ************** @ tk2msftngp13.phx.gbl ...
Have you tried converting to a color in the color class?

"jcrouse" <jo*********@comcast.net> wrote in message
news:uT**************@tk2msftngp13.phx.gbl...
我决定开始一个新线程。我有xml文件格式的输出。它
I decided to start a new thread. I have output in xml file format. It


看起来像这样的


looks



< P1JoyUp>
< Top> 326< / Top>
< Left> 54< / Left>
< Height> 23< / Height>
< Width> 100< / Width>
< Visible> True< / Visible>
< ForeColor>颜色[白色]< / ForeColor>
< BackColor>颜色[透明]< / BackColor>
<字体> [字体:名称= Microsoft Sans Serif,尺寸= 8.25,单位= 3,
GdiCharSet = 0,GdiVerticalFont = False]< / Font>
< / P1JoyUp>

我写出来并在使用中阅读一个数据集。现在,当我在
like this:

<P1JoyUp>
<Top>326</Top>
<Left>54</Left>
<Height>23</Height>
<Width>100</Width>
<Visible>True</Visible>
<ForeColor>Color [White]</ForeColor>
<BackColor>Color [Transparent]</BackColor>
<Font>[Font: Name=Microsoft Sans Serif, Size=8.25, Units=3,
GdiCharSet=0, GdiVerticalFont=False]</Font>
</P1JoyUp>

I write it out and read it in using a data set. Now when I read it in I

中读取它时,需要

将forecolor和backcolor字符串转换为
to convert the forecolor and backcolor strings to


system.drawing.something。


system.drawing.something.

我需要寻找答案。

谢谢,
John
WHere do I need to look for an answer.

Thanks,
John




CType(colorString,color)怎么样......虽然没有尝试过。

" jcrouse" < ME>在消息中写道

新闻:%2 **************** @ TK2MSFTNGP10.phx.gbl ...
How about CType(colorString,color) ... haven''t tried this though.
"jcrouse" <me> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
我'我正在看Color类和typeconverters,但我不理解
typedescriptor参数或他们在msdn帮助中给出的例子。

John

" ; Scott M. < S - *** @ nospam.nospam>在消息中写道
新闻:uW ************** @ TK2MSFTNGP09.phx.gbl ...
I''m looking at the Color class and typeconverters but I dont'' understand the typedescriptor parameter or the example they give in the msdn help.

John

"Scott M." <s-***@nospam.nospam> wrote in message
news:uW**************@TK2MSFTNGP09.phx.gbl...
您是否尝试过转换为颜色类?

" jcrouse" <乔********* @ comcast.net>在消息中写道
新闻:uT ************** @ tk2msftngp13.phx.gbl ...
Have you tried converting to a color in the color class?

"jcrouse" <jo*********@comcast.net> wrote in message
news:uT**************@tk2msftngp13.phx.gbl...
我决定开始一个新线程。我有xml文件格式的输出。它
I decided to start a new thread. I have output in xml file format. It


看起来像这样的


looks



< P1JoyUp>
< Top> 326< / Top>
< Left> 54< / Left>
< Height> 23< / Height>
< Width> 100< / Width>
< Visible> True< / Visible>
< ForeColor>颜色[白色]< / ForeColor>
< BackColor>颜色[透明]< / BackColor>
<字体> [字体:名称= Microsoft Sans Serif,尺寸= 8.25,单位= 3,
GdiCharSet = 0,GdiVerticalFont = False]< / Font>
< / P1JoyUp>

我写出来并在使用中阅读一个数据集。现在,当我在
like this:

<P1JoyUp>
<Top>326</Top>
<Left>54</Left>
<Height>23</Height>
<Width>100</Width>
<Visible>True</Visible>
<ForeColor>Color [White]</ForeColor>
<BackColor>Color [Transparent]</BackColor>
<Font>[Font: Name=Microsoft Sans Serif, Size=8.25, Units=3,
GdiCharSet=0, GdiVerticalFont=False]</Font>
</P1JoyUp>

I write it out and read it in using a data set. Now when I read it in


中读取它时,我需要

I need

将forecolor和backcolor字符串转换为
to convert the forecolor and backcolor strings to


system.drawing.something。


system.drawing.something.

我需要寻找答案。

谢谢,
John
WHere do I need to look for an answer.

Thanks,
John





这篇关于将String转换为COlor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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