我要顏色的多邊形...着色多邊形
這是多邊形我Compass.xaml:
<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"
現在我要填補這個多邊形與此顏色...
我試圖做到這一點與
arrow.fill('blue');
(只是隨機顏色嘗試,如果它是可行的。),但它沒有工作...
有人可以幫我嗎?
編輯:
好吧,它現在的作品。
string[] colorsplit = currentChannel.Color.Split('x');
arrow.Fill = GetColorFromHexa("#FF"+colorsplit[1]);
的問題是,我不知道,我已經把#FF在前面的字符串..
基於以下幾點:http://stackoverflow.com/questions/4305968/windows-phone-7-dynamically-set-button-background-color-from-hex:你可以使用arrow.Fill = GetColorFromHexa( 「#FFED1C24」); – 2012-03-20 10:52:32
我不知道如果我得到的顏色是六角顏色...這並沒有真正的工作.. – MrTouch 2012-03-20 11:24:17
如果你不確定你是否得到一個顏色,那麼你爲什麼試圖用它填充多邊形? – 2012-03-20 11:27:49