以下将为您提供所需的示例箭头,用于您的特定电话页面,中心位于底部,因此您可以将其放在指南针上。
它还有一个命名成员,MyTransform
您可以简单地设置旋转属性的角度(0 = 北,180 = 南等)。
<Path Data="M87.026947,24.16836 L102.66625,48.669857 L94.666451,48.669857 L94.666451,84.674995 L78.666855,84.674995 L78.666855,48.669857 L70.667053,48.669857 z" HorizontalAlignment="Right" Height="60.498" Stretch="Fill" UseLayoutRounding="False" VerticalAlignment="Bottom" Width="32" RenderTransformOrigin="0.5,1" Margin="0,0,208,191.502">
<Path.RenderTransform>
<CompositeTransform x:Name="MyTransform" Rotation="0" ScaleX="2.91" TranslateX="-16" TranslateY="-61" ScaleY="3.4"/>
</Path.RenderTransform>
<Path.Fill>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0"/>
<GradientStop Color="White" Offset="1"/>
<GradientStop Color="#FEFEFEFE" Offset="0.58"/>
<GradientStop Color="#FEE22828" Offset="0.604"/>
<GradientStop Color="#FEE64C4C" Offset="0.795"/>
<GradientStop Color="#FEFFFFFF" Offset="0.826"/>
</LinearGradientBrush>
</Path.Fill>
</Path>
示例图像:
它是通过导入您的示例图像并在顶部绘制而在 Expression blend 中创作的。然后缩放比例改变以匹配您的实际页面大小(因为显示的位图不是 1:1 比例)。
要使用从代码到所需角度的简单设置旋转
例如,根据您的代码段:
void DrawCompass()
{
MyTransform.Rotation = 0.0; // North
MyTransform.Rotation = 180.0; // South
MyTransform.Rotation = 90.0; // East
MyTransform.Rotation = 270.0; // West
// Or any other angle in between
// or simply bind the Rotation property to an angle property on your viewmodel
}