Saturday, 3 January 2015

Shapes Present in the WPF

WPF consists of a six shape elements. From the Six shapes, Path is the shape which is allows you to define a arbitrary shapes.Following are the Shapes which is used to render in UI.

Line           :  To draw a Line
PolyLine    :  To draw a multiple lines
Polygon     :  To draw a polygon
Rectangle  :  To draw a rectangle
Ellipse       :  To draw a Ellipse
Path           :  To draw a arbitrary user defined custom shape.


Line properties to draw: X1,Y1,X2,Y2

Polyline properties to draw : Points  collection of point

Polygon properties to draw: Points  collection of point

Rectangle properties to draw: Height, Width, RadiusX, RadiusY

Ellipse properties to draw:  Height, Width

Path properties to draw:  Data, which is collection of Geometry or Geometry. like Line Geometry, Rectangle Geometry, Ellipse Geometry,Path Geometry, Geometry Group, Combined Geometry, Stream Geometry.



       <StackPanel Margin="20,0,0,0" Orientation="Horizontal">
            <StackPanel>
                <Line Margin="0,0,0,10" X1="10" X2="100" Y1="15" Y2="18" Fill="Blue"                                 Stroke="Blue" StrokeThickness="5"></Line>
                <Polyline Margin="0,0,0,10" Points="10,40 40,50 50,80 80,30 100,50"                                 Stroke="BlueViolet" StrokeThickness="2"></Polyline>
                <Polygon Margin="0,0,0,10" Points="10,10 40,50 50,80 80,30"                                         Fill="ForestGreen"/>
                <Rectangle Margin="0,0,0,10" Width="50" Height="100" RadiusX="5"                                     RadiusY="10"  Fill="Red"></Rectangle>
                <Ellipse Margin="0,0,0,10" Width="100" Height="50" Stroke="Chocolate"                               StrokeThickness="3" Fill="RoyalBlue"></Ellipse>
                <Path Fill="Pink" Stroke="SaddleBrown" StrokeThickness="5">
                    <Path.Data>
                        <GeometryGroup>
                            <LineGeometry StartPoint="10,10" EndPoint="200,20">                                                     </LineGeometry>
                            <RectangleGeometry Rect="10,20,200,10"></RectangleGeometry>
                        </GeometryGroup>
                    </Path.Data>
                </Path>
            </StackPanel>
         </StackPanel>

       

Output
************




From the above you can learn shapes present in the wpf.






No comments:

Post a Comment