读书人

blend如何画曲线图

发布时间: 2013-08-16 14:29:57 作者: rapoo

blend怎么画曲线图
要画两个曲线图,就像示波器那种,带坐标,用什么控件?
我知道在winform里可以用graphpane,blend里面有没有类似的? 控件 画图 WPF
[解决办法]
Path或PolyLine

private void CreateAPolyline()
{
// Create a blue and a black Brush
SolidColorBrush yellowBrush = new SolidColorBrush();
yellowBrush.Color = Colors.Yellow;
SolidColorBrush blackBrush = new SolidColorBrush();
blackBrush.Color = Colors.Black;

// Create a polyline
Polyline yellowPolyline = new Polyline();
yellowPolyline.Stroke = blackBrush;
yellowPolyline.StrokeThickness = 4;

// Create a collection of points for a polyline
System.Windows.Point Point1 = new System.Windows.Point(10, 100);
System.Windows.Point Point2 = new System.Windows.Point(100, 200);
System.Windows.Point Point3 = new System.Windows.Point(200, 30);
System.Windows.Point Point4 = new System.Windows.Point(250, 200);
System.Windows.Point Point5 = new System.Windows.Point(200, 150);
PointCollection polygonPoints = new PointCollection();
polygonPoints.Add(Point1);
polygonPoints.Add(Point2);
polygonPoints.Add(Point3);
polygonPoints.Add(Point4);
polygonPoints.Add(Point5);

// Set Polyline.Points properties
yellowPolyline.Points = polygonPoints;

// Add polyline to the page
LayoutRoot.Children.Add(yellowPolyline);
}

读书人网 >C#

热点推荐