By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,330 Members | 1,277 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,330 IT Pros & Developers. It's quick & easy.

creating color object

P: n/a
hi

i have a string like "ffff032d" which represents
a color.

i want to create a color object given this value
but am having trouble.

this is what i have so far.

Color myColor = Color.FromArgb(Convert.ToInt32
("ffff032d"));

it fails to convert the string to an int.
thx - fg
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
fg,

When converting the string, you should be able to do the following:

// Get the color.
Color myColor = Color.FromArgb(Convert.ToInt32("fffff032d", 16));

The ToInt32 method allows you to specify the base that you want to
interpret the string in.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"fragget" <fr*****@home.com> wrote in message
news:02****************************@phx.gbl...
hi

i have a string like "ffff032d" which represents
a color.

i want to create a color object given this value
but am having trouble.

this is what i have so far.

Color myColor = Color.FromArgb(Convert.ToInt32
("ffff032d"));

it fails to convert the string to an int.
thx - fg

Nov 13 '05 #2

P: n/a
awesome, thanks.

On Tue, 15 Jul 2003 16:19:11 -0400, "Nicholas Paldino [.NET/C# MVP]"
<ni**************@exisconsulting.com> wrote:
fg,

When converting the string, you should be able to do the following:

// Get the color.
Color myColor = Color.FromArgb(Convert.ToInt32("fffff032d", 16));

The ToInt32 method allows you to specify the base that you want to
interpret the string in.

Hope this helps.


Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.