Sun Changing? DrawingVisual Fl? Surface and contour

I have a DrawingVisual object and I want to change its fill and its stroke.

I’ve tried this for Fill:

DrawingVisual MyDrawing = new DrawingVisual();
SetFill(Brushes.Red, MyDrawing.Drawing);

Where SetFill is:

private void SetFill(Brush fill, DrawingGroup group)
    foreach (Drawing drw in group.Children)
        if (drw is DrawingGroup)
            SetFill(fill, drw as DrawingGroup);
        else if (drw is GeometryDrawing)
            GeometryDrawing geo = drw as GeometryDrawing;
            geo.Brush = fill;

            using (DrawingContext context = MyDrawing.RenderOpen())

But in this way may happen that my DrawingVisual is drawn to a different position, as if the transformations have not been applied more (to MyDrawing).

How can I do?

This entry was posted in Codes & Scripts and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>