Hi Moondaddy,
Thank you for your prompt reply!
The following is a sample of polygon with rounded corners in XAML:
<Path Stroke="Black" StrokeThickness="2">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure StartPoint="0,25"
IsClosed="true">
<PathFigure.Segments>
<PathSegmentCollection>
<ArcSegment Size="25,25"
SweepDirection="Clockwise" Point="25,0" />
<LineSegment Point="200,0"/>
<ArcSegment Size="25,25"
IsLargeArc="false" SweepDirection="Clockwise" Point="225,25"/>
<LineSegment Point="225,150"/>
<ArcSegment Size="25,25"
IsLargeArc="false" SweepDirection="Clockwise" Point="200,175"/>
<LineSegment Point="25,175"/>
<ArcSegment Size="25,25"
IsLargeArc="false" SweepDirection="Clockwise" Point="0,150"/>
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>
The following is a sample in code:
private void Window_Loaded(object sender, RoutedEventArgs e)
{
Path path = new Path();
path.Stroke = Brushes.Black;
path.StrokeThickness = 2;
PathGeometry pg = new PathGeometry();
PathFigure pf = new PathFigure();
pf.StartPoint = new Point(0, 25);
pf.IsClosed = true;
ArcSegment arcs = new ArcSegment();
arcs.Size = new Size(25, 25);
arcs.IsLargeArc = false;
arcs.SweepDirection = SweepDirection.Clockwise;
arcs.Point = new Point(25, 0);
pf.Segments.Add(arcs);
LineSegment lines = new LineSegment();
lines.Point = new Point(200, 0);
pf.Segments.Add(lines);
arcs = new ArcSegment();
arcs.Size = new Size(25, 25);
arcs.IsLargeArc = false;
arcs.SweepDirection = SweepDirection.Clockwise;
arcs.Point = new Point(225, 25);
pf.Segments.Add(arcs);
lines = new LineSegment();
lines.Point = new Point(225, 150);
pf.Segments.Add(lines);
arcs = new ArcSegment();
arcs.Size = new Size(25, 25);
arcs.IsLargeArc = false;
arcs.SweepDirection = SweepDirection.Clockwise;
arcs.Point = new Point(200, 175);
pf.Segments.Add(arcs);
lines = new LineSegment();
lines.Point = new Point(25, 175);
pf.Segments.Add(lines);
arcs = new ArcSegment();
arcs.Size = new Size(25, 25);
arcs.IsLargeArc = false;
arcs.SweepDirection = SweepDirection.Clockwise;
arcs.Point = new Point(0, 150);
pf.Segments.Add(arcs);
pg.Figures.Add(pf);
path.Data = pg;
Grid grid = new Grid();
grid.Children.Add(path);
this.Content = grid;
}
Hope this helps.
If you have any question, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.
This posting is provided "AS IS" with no warranties, and confers no rights.