2012-03-20 1 views
0

색칠 :이는 내 Compass.xaml에서 다각형이다</p> <p>... 나는 다각형 색상을 원하는 다각형

<Polygon x:Name="arrow" Points="5, 90 35, 90 35, 160 65, 160 65, 90 95, 90 50, 5" Stroke="Black" StrokeThickness="4" Fill="White" Margin="42,32,184,0" Grid.Column="1" Grid.ColumnSpan="2" Height="163" VerticalAlignment="Top"> 
    <Polygon.RenderTransform> 
     <RotateTransform x:Name="rotateArrow" Angle="0" CenterX="50" CenterY="160" /> 
    </Polygon.RenderTransform> 
</Polygon> 

내가에서 색상을 얻을 곳이다 :

Channel lbi = (Channel) GlobalVariables.ChannelList[Channelindex]; 

lbi.Color => "0xED1C24" 

지금은이 색상이 다각형을 채우기 위해 가지고는 ...

나는

012,351,641 함께 할 것을 시도
arrow.fill('blue'); 

누군가가 나를 도울 수 ... (그냥 임의의 색상 작동한다면. 시도합니다) 그러나 그것은 작동하지 않았다?

편집 :

이제 정상적으로 작동합니다.

string[] colorsplit = currentChannel.Color.Split('x'); 
arrow.Fill = GetColorFromHexa("#FF"+colorsplit[1]); 

문제는

+1

: http://stackoverflow.com/questions/4305968/windows-phone-7-dynamically-set-button-background-color-from-hex : 당신은 사용할 수 arrow.Fill = GetColorFromHexa ("# FFED1C24"); –

+0

색상이 Hexa Color인지 확실하지 않습니다 ... 실제로 작동하지 않습니다 .. – MrTouch

+0

Color를 얻고 있는지 확실하지 않은 경우 왜 Polygon으로 채우려고합니까? –

답변

2

C#? 다음을 기반으로

arrow.Fill = new SolidColorBrush(System.Windows.Media.Colors.Blue); 
+0

이 작동하지만 내가 말했듯이, 나는 색 정보와 함께 할 필요가 : "0x945316" – MrTouch

+0

arrow.Fill = new SolidColorBrush (System.Windows.Media.Color.FromRgb (0x94,0x53, 0x16)); – paul

+0

내가 이것을 할 때 검은 색으로 변하게됩니다. 어떤 종류의 값을 가져 가는지 상관하지 않습니다 ... – MrTouch

2

무엇

arrow.Fill = new SolidColorBrush(Colors.Blue); 

에 대해 .. 내가 문자열의 앞에 # FF를 넣어야 할 것을 알고하지 않았다했다?