(1) convert hexadecimal strings to Integers // convert string color to int color (for example, # ffffff to 65535)
StringArgb = node. selectsinglenode ("Renderstyle/penstyle/pencolor"). Innertext;IntRgbvalue = convert. toint32 (argb,16);
VaR Colorset = New String [] { " # Ff880000 " , " # Ffff0000 " , " # Ff008800 " , " # Ff00ff00 " , " # Ff000088 " , " # Ff0000ff " , " # Ff888800 " , " # Ff880088 " , " # Ffff8800 " , " # Ffff0088 " }; Temppoly. fillstyle. fillcolor = Convert. toint32 (slopecolor. substring ( 1 ), 16 );
Take a certain color component
Because the previous colors are composed of RGB 62580 = 0xf474 The corresponding color: red = 0 Green = 244 Blue = 116 Use it to form the current argb color format, that is, color mycolor = Color. fromargb ( 0 , 244 , 116 ); For any original color, you can: Int Ncolor = 62580 ; Int Nblue = ncolor % 256 ; Int Ngreen = (ncolor-nblue )/ 256 ) % 256 ; Int Nred = (ncolor-ngreen * 256 -Nblue )/ 256 )/ 256 ) % 256 ; Color yournewcolor = Color. fromargb (nred, ngreen, nblue );