摘要:wpf 繪圖
	           //########### 繪製圓型 ################
	           
	            StackPanel myStackPanel = new StackPanel();
	            // Create a red Ellipse.
	            Ellipse myEllipse = new Ellipse();
	            // Create a SolidColorBrush with a red color to fill the
	            // Ellipse with.
	            SolidColorBrush mySolidColorBrush = new SolidColorBrush();
	            // Describes the brush's color using RGB values.
	            // Each value has a range of 0-255.
	            mySolidColorBrush.Color = Color.FromArgb(255, 255, 0, 0);
	            myEllipse.Fill = mySolidColorBrush;
	            // Set the width and height of the Ellipse.
	            myEllipse.Width = 100;
	            myEllipse.Height = 100;
	            // Add the Ellipse to the StackPanel.
	            canvas1.Children.Clear();
	            canvas1.Children.Add(myEllipse);
______________________________________________
	      //############# 繪製直線 ################
	            Line  myLine = new Line();
	            myLine.Stroke = System.Windows.Media.Brushes.LightSteelBlue;
	            myLine.X1 = 1;
	            myLine.X2 = 50;
	            myLine.Y1 = 1;
	            myLine.Y2 = 50;
	            myLine.HorizontalAlignment = HorizontalAlignment.Left;
	            myLine.VerticalAlignment = VerticalAlignment.Center;
	            myLine.StrokeThickness = 2;
	            canvas1.Children.Clear();
	            canvas1.Children.Add(myLine);
________________________________________
//########### 繪製路徑 ###################
	            //建立幾何的子區段
	            PathFigure myPathFigure = new PathFigure();
	            //起始點
	            myPathFigure.StartPoint = new Point(10, 50);
	            //在兩點之間建立三次方貝茲曲線。
	            myPathFigure.Segments.Add(
	                new BezierSegment(
	                    new Point(100, 0),
	                    new Point(200, 200),
	                    new Point(300, 100),
	                    true /* IsStroked 將片段描邊 */  ));
	            //在兩點之間建立線條。
	            myPathFigure.Segments.Add(
	                new LineSegment(
	                    new Point(400, 100),
	                    true /* IsStroked 將片段描邊 */ ));
	            //在兩點之間建立橢圓弧線。
	            myPathFigure.Segments.Add(
	                new ArcSegment(
	                    new Point(200, 100),//設定橢圓弧形的端點。這是相依性屬性。
	                    new Size(50, 50),//設定弧形的 X 半徑和 Y 半徑。這是相依性屬性。
	                    45,//設定橢圓形繞著 X 軸旋轉的量 (以度數為單位)。這是相依性屬性。
	                    true, // IsLargeArc 弧形是否應大於 180 度。這是相依性屬性。
	                    SweepDirection.Clockwise, //以 Clockwise 或 Counterclockwise 方向繪製弧形
	                    true) // IsStroked  將片段描邊
	                      );
	            //相關網址
	            //http://msdn.microsoft.com/zh-tw/library/system.windows.media.arcsegment(v=vs.90).aspx
	            /// Create a PathGeometry to contain the figure.
	            PathGeometry myPathGeometry = new PathGeometry();
	            myPathGeometry.Figures.Add(myPathFigure);
	            // Display the PathGeometry.
	            Path myPath = new Path();
	            myPath.Stroke = Brushes.Black;
	            myPath.StrokeThickness = 1;
	            myPath.Data = myPathGeometry;
	            canvas1.Children.Clear();
	            canvas1.Children.Add(myPath);
#region <相關資料>
	            //ArcSegment       在兩點之間建立橢圓弧線。
	            //BezierSegment       在兩點之間建立三次方貝茲曲線。
	            //LineSegment       在兩點之間建立線條。
	            //PolyBezierSegment      建立一系列的三次方貝茲曲線。
	            //PolyLineSegment   建立一系列線條。
	            //PolyQuadraticBezierSegment 建立一系列二次方貝茲曲線。
	            //QuadraticBezierSegment  建立一條二次方貝茲曲線。
	            #endregion
	______________________________________________________
	           //#########  繪製正方型 ######################
	            RectangleGeometry myRectangleGeometry = new RectangleGeometry();
	            myRectangleGeometry.Rect = new Rect(50, 50, 25, 25);
	            Path myPath = new Path();
	            myPath.Fill = Brushes.LemonChiffon;
	            myPath.Stroke = Brushes.Black;
	            myPath.StrokeThickness = 1;
	            myPath.Data = myRectangleGeometry;
	            canvas1.Children.Clear();
	            canvas1.Children.Add(myPath);