View Single Post
Old 03-08-2007   #8 (permalink)
Thomas Lee


 
 

Re: Translating colors to hex and back

In message <222FDFD3-E735-4B99-9A53-E31E67D4F0B3@microsoft.com>,
"/\\/\\o\\/\\/ [MVP]" <mow001@hotmail.NoSpam> writes
>PoSH> $c = [drawing.color]'red'
>PoSH> "{0:x}" -f $c.ToArgb()
>ffff0000
>
>;-)



Thanks VERY much.

BTW: where is this format documented?

The calling seqence is a bit off, I sort of expected
"{0:x} in hex`n{1} in decimal" -f $c.ToArgb() $c.ToArgb()

To work. But it generated an error, whereas:

I was sort of surprised to find this worked:
PSH [D:\foo]: "{0:x} in hex`n{1} in decimal" -f $c.ToArgb(),$c.ToArgb()
ffff0000 in hex
-65536 in decimal

I expected the paramaters to the right of '-f' to be space, not comma
delimited.

Thomas
--
Thomas Lee
doctordns@gmail.com
MVP - Admin Frameworks and Security
My System SpecsSystem Spec