Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hey, I have from the Internet an Geometry Figure which looks like this:

<PathGeometry x:Key="A4" Figures="M10.5495 2.53189C11.3874 1.82531 12.6126 1.82531 13.4505 2.5319L20.2005 8.224C20.7074 8.65152 21 9.2809 21 9.94406V19.7468C21 20.7133 20.2165 21.4968 19.25 21.4968H15.75C14.7835 21.4968 14 20.7133 14 19.7468V14.2468C14 14.1088 13.8881 13.9968 13.75 13.9968H10.25C10.1119 13.9968 9.99999 14.1088 9.99999 14.2468V19.7468C9.99999 20.7133 9.2165 21.4968 8.25 21.4968H4.75C3.7835 21.4968 3 20.7133 3 19.7468V9.94406C3 9.2809 3.29255 8.65152 3.79952 8.224L10.5495 2.53189ZM12.4835 3.6786C12.2042 3.44307 11.7958 3.44307 11.5165 3.6786L4.76651 9.37071C4.59752 9.51321 4.5 9.72301 4.5 9.94406V19.7468C4.5 19.8849 4.61193 19.9968 4.75 19.9968H8.25C8.38807 19.9968 8.49999 19.8849 8.49999 19.7468V14.2468C8.49999 13.2803 9.2835 12.4968 10.25 12.4968H13.75C14.7165 12.4968 15.5 13.2803 15.5 14.2468V19.7468C15.5 19.8849 15.6119 19.9968 15.75 19.9968H19.25C19.3881 19.9968 19.5 19.8849 19.5 19.7468V9.94406C19.5 9.72301 19.4025 9.51321 19.2335 9.37071L12.4835 3.6786Z"/>

that Creates a House, but I have no Idea to draw Own Figures, when I want to draw simply a B how I would do that?

What I have tried:

Never done something like so, could someone help me?
Updated 2-Aug-22 1:16am
EstKells 2-Aug-22 6:06am    
I mean, I try it before but the only Geometry Forms I can make does not looking good and I have no Idee how to make at as good as I posted the Example. Is out there some list with figures?
Maciej Los 2-Aug-22 6:09am    
I have no idea if there's a list of figures. It's quite simple to draw own figures. See: WPF Shapes - Path - Path Geometry[^]

1 solution

To create a B letter, you can use something similar to this:
    <Path Stroke="Black" StrokeThickness="1" Fill="ForestGreen">
                    <PathFigure StartPoint="10,10" IsClosed="True">
                        <LineSegment Point="10,70"/>
                        <LineSegment Point="30,70"/>
                        <LineSegment Point="40,60"/>
                        <LineSegment Point="40,50"/>
                        <LineSegment Point="30,40"/>
                        <LineSegment Point="40,30"/>
                        <LineSegment Point="40,20"/>
                        <LineSegment Point="30,10"/>
                    <PathFigure StartPoint="20,20" IsClosed="True">
                        <LineSegment Point="20,30"/>
                        <LineSegment Point="27,30"/>
                        <LineSegment Point="30,27"/>
                        <LineSegment Point="30,23"/>
                        <LineSegment Point="27,20"/>
                    <PathFigure StartPoint="20,50" IsClosed="True">
                        <LineSegment Point="20,60"/>
                        <LineSegment Point="27,60"/>
                        <LineSegment Point="30,57"/>
                        <LineSegment Point="30,53"/>
                        <LineSegment Point="27,50"/>

Now, you're able to translate it to StreamGeometry[^], a lighter-weight version of a PathGeometry[^] - using Path Markup Syntax[^].

All those details have been described here: How to: Create Multiple Subpaths Within a PathGeometry - WPF .NET Framework | Microsoft Docs[^]
Note that:
M or m defines a startPoint
L or l defines an endPoint
H or h - horizontal line
V or v - vertical line
Z or z - close command - ends the current figure and creates a line that connects the current point to the starting point of the figure; this command creates a line-join (corner) between the last segment and the first segment of the figure.

Good luck!
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900