Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
AdornerLayer for Path
Message
De
20/04/2010 00:55:37
 
 
À
19/04/2010 13:56:09
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Versions des environnements
Environment:
C# 3.0
Divers
Thread ID:
01460940
Message ID:
01461029
Vues:
34
>Hi,
>
>Given a Path like so:
<Path Stroke="Black">
>            <Path.Data>
>                <PathGeometry>
>                    <PathFigure StartPoint="0,0">
>                        <BezierSegment />
>                    </PathFigure>
>                </PathGeometry>
>            </Path.Data>
>        </Path>
I want to use this with an AdornerLayer. At the moment I have this (which works as far as it goes when the BezierSeqment is populated)
public class PathAdorner : Adorner
>    {
>        Path p;
>        PathFigure pf;
>        BezierSegment bs;
>
>        readonly VisualCollection _visualChildren;
>
>        public StretchAdorner(UIElement adornedElement)
>            : base(adornedElement)
>        {
>            _visualChildren = new VisualCollection(this);
>            p = (Path)adornedElement;
>            PathGeometry pg = (PathGeometry) p.Data;
>            pf = pg.Figures[0];
>            bs = (BezierSegment) pf.Segments[0];
>         }
>
>        protected override void OnRender(DrawingContext drawingContext)
>        {
>            drawingContext.DrawEllipse(new SolidColorBrush(Colors.Red), null, pf.StartPoint, 5, 5);
>            drawingContext.DrawEllipse(new SolidColorBrush(Colors.Green), null, bs.Point1, 5, 5);
>            drawingContext.DrawEllipse(new SolidColorBrush(Colors.Green), null, bs.Point2, 5, 5);
>            drawingContext.DrawEllipse(new SolidColorBrush(Colors.Red), null, bs.Point3, 5, 5);
>        }
>
>        protected override int VisualChildrenCount { get { return _visualChildren.Count; } }
>        protected override Visual GetVisualChild(int index) { return _visualChildren[index]; }
>    }
But I want to use Thumbs rather than just drawing in OnRender(). I know the principal is to create the Thumbs and add them to the VisualChildren collection and to place them in the ArrangeOverride method but can't work out how to get the correct placements.
>
>Any ideas?

Not sure I'm fully understanding what you want.

Why ArrangeOverride? Why not just add the thumbs to the AdornerLayer of the path?

I haven't actually played with this myself yet. (It's a to do item for my code <g>)

But I did load the code here:

http://dvuyka.spaces.live.com/blog/cns!305B02907E9BE19A!144.entry

and I "think" maybe it might be doing what you want???
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform