CombinedGeometry Class WPF in VB.NET

In this article you will learn about the CombinedGeometry Class of WPF.
  • 857

As you see an GeometryGroup Classes example in my previous article, now we see the CombineGeometry in this article.

CombinedGeometry: CombinedGeometry is combining shapes that overlap, and where neither shape contains the other completely, CombinedGeometry takes just two geometries, which you supply using the Geometry1 and Geometry2 properties. A CombinedGeometry uses a specified boolean operation to combine the area described by two Geometry objects. The static Combine method of the Geometry class behaves in exactly the same manner as the CombinedGeometry object.

CombinedGeometry has a GeometryCombineMode attribute to set the combine mode. It can get one of following values.To understand these modes apply these operations to two sets in mathematics.

  • Union: New shape contains all points of two older shapes.  This is the default value.

  • Intersect: New shape contains all points that are shared between two shapes.

  • Xor: New shape contains all points between two older shapes except what is shared between them.

  • Exclude: New shape contains all points between first shape and not second shape.

Example of CombinedGeometry

<Window x:Class="Window1"
    Title="Window1" Height="300" Width="300">
    <Path Fill="Pink" Stroke="Red" Margin="10">
            <CombinedGeometry GeometryCombineMode="Union">
                    <RectangleGeometry Rect="5,5 120,80"></RectangleGeometry>
                    <EllipseGeometry Center="105,45" RadiusX="85" RadiusY="40"></EllipseGeometry>

Output Window



Hope this is clear you to the CombinedGeometry class in WPF. Remaining part of this article you will see my next article.


More Articles

© 2013 dotNetheaven. All rights reserved.