我該如何創建量表(即速度計)?我該如何創建一個量表(即速度計)?
具體而言,我試圖在此link上構建圖像。
我成功創造一個環。但是,現在我需要將刻度添加到環中。
XAML:
<Window x:Class="MotoLens.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:MotoLens"
mc:Ignorable="d"
Background="Black"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<local:ValueToBrushConverter x:Key="ValueToBrushConverter" />
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Ellipse Grid.Row="0" Width="300" Fill="Transparent" StrokeThickness="10" Stroke="{Binding ElementName=Slider, Path=Background}" StrokeDashArray="1" StrokeEndLineCap="Square" />
</Grid>
</Window>
爲什麼在發佈XAML和ValueConverter代碼時,如果與上一個問題沒有關係,您最後一個問題?無論如何,我會創建兩個圖形,其中一個點亮而不是另一個。將未亮起的一個放在背景中,然後將點亮的一個放在背景中,然後創建一個ArcSegment,並相應地設置開始和結束角度,並將其用作點亮圖形的不透明度圖。 –
我會搜索「WPF速度計」並使用其中的答案,例如https://wpfgauge.codeplex.com/ –
@MarkFeldman - 感謝您的幫助。這可以使用XAML來完成嗎?或者我以編程方式做這個? –