资 源 简 介
C# 使用图像控件显示绘制的多个几何图形,可一次显示多个绘制的图形,相关代码如下:
GeometryGroup MyGeometry = new GeometryGroup();
MyGeometry.Children.Add(new EllipseGeometry(new Point(50, 50), 45, 20));
MyGeometry.Children.Add(new EllipseGeometry(new Point(50, 50), 20, 45));
RectangleGeometry MyRectangle = new RectangleGeometry();
MyRectangle.Rect = new Rect(2, 2, 96, 96);
MyGeometry.Children.Add(MyRectangle);
GeometryDrawing MyDrawing = new GeometryDrawing();
MyDrawing.Geometry = MyGeometry;
MyDrawing.Pen = new Pen(Brushes.Blue, 3);
DrawingImage MyImage = new DrawingImage();
MyImage.Drawing = MyDrawing;
MyImage.Freeze();
this.image1.Source = MyImage;