例如,我使用此方法创建了一个DrawingVisual对象:
Private Function CreateDrawingVisualRectangle() As DrawingVisual
Dim drawingVisual As New DrawingVisual()
Dim drawingContext As DrawingContext = drawingVisual.RenderOpen()
Dim rect As New Rect(New Point(160, 100), New Size(320, 80))
drawingContext.DrawRectangle(Brushes.LightBlue, New Pen(Brushes.Black, 0.5), rect)
Return drawingVisual
End Function
有没有办法获取 DrawingContext方法绘制的形状类型及其属性?
IE:
Dim MyVisual as DrawingVisual = CreateDrawingVisualRectangle()
Dim MyVisualType as MyType = MyVisual.GetDrawingType()
Dim MyBrush as Brush = MyVisual.GetDrawingBrush()
Dim MyPen as Pen = MyVisual.GetDrawingPen()
Dim MyRect as Rect = MyVisual.GetDrawingRect()
...
显然,我在上一个示例中使用的方法是指示性方法,实际上并不存在,但我会使用它来获取 MyVisual 属性。
谢谢。