我有一组点(代表一张罪孽图)我如何绘制图形?
c#code:
string[] lines = System.IO.File.ReadAllLines("AnaloguData.txt");
PointCollection myPointCollection = new PointCollection();
for (int i = 0; i < lines.Length; i++)
{
string[] words = lines[i].Split('\t');
myPointCollection.Add(new Point(Convert.ToDouble(words[0]), Convert.ToDouble(words[1])));
}
curve.Points = myPointCollection;
xaml代码:
<Grid>
<Button Content="Button" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="61,294,0,0" Click="Button_Click"/>
<Canvas HorizontalAlignment="Left" Height="477" VerticalAlignment="Top" Width="538" Margin="158,294,0,0">
<Polyline Name="curve" />
</Canvas>
</Grid>
我不明白为什么这段代码不起作用。 Sombody有更好的主意吗?