Re: Convert String to COlor
Well...this seems to work:
lblP1JoyUp.Fore Color =
Color.FromArgb( ds.Tables(0).Ro ws(0).Item(5))
lblP1JoyUp.Back Color =
Color.FromArgb( ds.Tables(0).Ro ws(0).Item(6))
Does it look correct?
Thanks,
John
"jcrouse" <me> wrote in message news:Ofa2axKUEH A.712@TK2MSFTNG P11.phx.gbl...[color=blue]
> I also like this method. It is easy to write to the xml file with this
> method. Here is a sample:
>
> <CPViewer>
>
> <P1JoyUp>
>
> <Top>136</Top>
>
> <Left>99</Left>
>
> <Height>23</Height>
>
> <Width>100</Width>
>
> <Visible>True </Visible>
>
> <ForeColor>-256</ForeColor>
>
> <BackColor>-16777216</BackColor>
>
> <FontName>Micro soft Sans Serif</FontName>
>
> <FontSize>8.2 5</FontSize>
>
> <FontBold>False </FontBold>
>
> <FontItalic>Fal se</FontItalic>
>
> </P1JoyUp>
>
>
> However, I can't get the code right to read it back in. This is what I
> tried, amoungst many other syntaxes:
>
> If OpenFileDialog1 .FileName <> "" Then
>
> Dim ds As New DataSet
>
> ds.ReadXml(Open FileDialog1.Fil eName)
>
> lblP1JoyUp.Top = ds.Tables(0).Ro ws(0).Item(0).T oString
>
> lblP1JoyUp.Left = ds.Tables(0).Ro ws(0).Item(1).T oString
>
> lblP1JoyUp.Heig ht = ds.Tables(0).Ro ws(0).Item(2).T oString
>
> lblP1JoyUp.Widt h = ds.Tables(0).Ro ws(0).Item(3).T oString
>
> lblP1JoyUp.Visi ble = ds.Tables(0).Ro ws(0).Item(4).T oString
>
> lblP1JoyUp.Fore Color.FromArgb( ds.Tables(0).Ro ws(0).Item(5))
>
> lblP1JoyUp.Back Color.FromArgb( ds.Tables(0).Ro ws(0).Item(6))
>
>
>
> Any idea on the reading part,
>
> John
>
>
>
>
> "J M" <a@b.com> wrote in message
> news:%23eL%23LZ FUEHA.4048@TK2M SFTNGP12.phx.gb l...[color=green]
> > I always use Color.ToARGB to write, and
> > Color.FromARGB to read them back again.
> > I think that's much easier to do...
> >
> > Hope I helped,
> >
> >
> > J Mous
> >
> > "jcrouse" <john.crouse@co mcast.net> schreef in bericht
> > news:uTtokEDUEH A.2408@tk2msftn gp13.phx.gbl...[color=darkred]
> > > I decided to start a new thread. I have output in xml file format. It[/color]
> > looks[color=darkred]
> > > like this:
> > >
> > > <P1JoyUp>
> > > <Top>326</Top>
> > > <Left>54</Left>
> > > <Height>23</Height>
> > > <Width>100</Width>
> > > <Visible>True </Visible>
> > > <ForeColor>Colo r [White]</ForeColor>
> > > <BackColor>Colo r [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[/color][/color][/color]
I[color=blue][color=green]
> > need[color=darkred]
> > > to convert the forecolor and backcolor strings to[/color]
> > system.drawing. something.[color=darkred]
> > > WHere do I need to look for an answer.
> > >
> > > Thanks,
> > > John
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]
Well...this seems to work:
lblP1JoyUp.Fore Color =
Color.FromArgb( ds.Tables(0).Ro ws(0).Item(5))
lblP1JoyUp.Back Color =
Color.FromArgb( ds.Tables(0).Ro ws(0).Item(6))
Does it look correct?
Thanks,
John
"jcrouse" <me> wrote in message news:Ofa2axKUEH A.712@TK2MSFTNG P11.phx.gbl...[color=blue]
> I also like this method. It is easy to write to the xml file with this
> method. Here is a sample:
>
> <CPViewer>
>
> <P1JoyUp>
>
> <Top>136</Top>
>
> <Left>99</Left>
>
> <Height>23</Height>
>
> <Width>100</Width>
>
> <Visible>True </Visible>
>
> <ForeColor>-256</ForeColor>
>
> <BackColor>-16777216</BackColor>
>
> <FontName>Micro soft Sans Serif</FontName>
>
> <FontSize>8.2 5</FontSize>
>
> <FontBold>False </FontBold>
>
> <FontItalic>Fal se</FontItalic>
>
> </P1JoyUp>
>
>
> However, I can't get the code right to read it back in. This is what I
> tried, amoungst many other syntaxes:
>
> If OpenFileDialog1 .FileName <> "" Then
>
> Dim ds As New DataSet
>
> ds.ReadXml(Open FileDialog1.Fil eName)
>
> lblP1JoyUp.Top = ds.Tables(0).Ro ws(0).Item(0).T oString
>
> lblP1JoyUp.Left = ds.Tables(0).Ro ws(0).Item(1).T oString
>
> lblP1JoyUp.Heig ht = ds.Tables(0).Ro ws(0).Item(2).T oString
>
> lblP1JoyUp.Widt h = ds.Tables(0).Ro ws(0).Item(3).T oString
>
> lblP1JoyUp.Visi ble = ds.Tables(0).Ro ws(0).Item(4).T oString
>
> lblP1JoyUp.Fore Color.FromArgb( ds.Tables(0).Ro ws(0).Item(5))
>
> lblP1JoyUp.Back Color.FromArgb( ds.Tables(0).Ro ws(0).Item(6))
>
>
>
> Any idea on the reading part,
>
> John
>
>
>
>
> "J M" <a@b.com> wrote in message
> news:%23eL%23LZ FUEHA.4048@TK2M SFTNGP12.phx.gb l...[color=green]
> > I always use Color.ToARGB to write, and
> > Color.FromARGB to read them back again.
> > I think that's much easier to do...
> >
> > Hope I helped,
> >
> >
> > J Mous
> >
> > "jcrouse" <john.crouse@co mcast.net> schreef in bericht
> > news:uTtokEDUEH A.2408@tk2msftn gp13.phx.gbl...[color=darkred]
> > > I decided to start a new thread. I have output in xml file format. It[/color]
> > looks[color=darkred]
> > > like this:
> > >
> > > <P1JoyUp>
> > > <Top>326</Top>
> > > <Left>54</Left>
> > > <Height>23</Height>
> > > <Width>100</Width>
> > > <Visible>True </Visible>
> > > <ForeColor>Colo r [White]</ForeColor>
> > > <BackColor>Colo r [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[/color][/color][/color]
I[color=blue][color=green]
> > need[color=darkred]
> > > to convert the forecolor and backcolor strings to[/color]
> > system.drawing. something.[color=darkred]
> > > WHere do I need to look for an answer.
> > >
> > > Thanks,
> > > John
> > >
> > >[/color]
> >
> >[/color]
>
>[/color]
Comment