Using GeometryCombineMode of CombinedGeometry WPF in VB.NET

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

See Part 1
This article explain you the remaining types values of the GeometryCombineMode attribute of CombinedGeometry Class.

Intersect:

<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Path Fill="Pink" Stroke="Red" Margin="10">
        <Path.Data>
            <CombinedGeometry GeometryCombineMode="Intersect">
                <CombinedGeometry.Geometry1>
                    <RectangleGeometry Rect="5,5 120,80"></RectangleGeometry>
                </CombinedGeometry.Geometry1>
                <CombinedGeometry.Geometry2>
                    <EllipseGeometry Center="105,45" RadiusX="85" RadiusY="40"></EllipseGeometry>
                </CombinedGeometry.Geometry2>
            </CombinedGeometry>
        </Path.Data>
    </Path>
</
Window>

Output Window

cg2.gif

 

Xor:

<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Path Fill="Pink" Stroke="Red" Margin="10">
        <Path.Data>
            <CombinedGeometry GeometryCombineMode="Xor">
                <CombinedGeometry.Geometry1>
                    <RectangleGeometry Rect="5,5 120,80"></RectangleGeometry>
                </CombinedGeometry.Geometry1>
                <CombinedGeometry.Geometry2>
                    <EllipseGeometry Center="105,45" RadiusX="85" RadiusY="40"></EllipseGeometry>
                </CombinedGeometry.Geometry2>
            </CombinedGeometry>
        </Path.Data>
   
</Path>

</Window>

Output Window

cg3.gif

 

Exclude:

<Window x:Class="Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300">
    <Path Fill="Pink" Stroke="Red" Margin="10">
        <Path.Data>
            <CombinedGeometry GeometryCombineMode="Exclude">
                <CombinedGeometry.Geometry1>
                    <RectangleGeometry Rect="5,5 120,80"></RectangleGeometry>
                </CombinedGeometry.Geometry1>
                <CombinedGeometry.Geometry2>
                    <EllipseGeometry Center="105,45" RadiusX="85" RadiusY="40"></EllipseGeometry>
                </CombinedGeometry.Geometry2>
            </CombinedGeometry>
        </Path.Data>
    </Path>

</Window>

Output Window

cg4.gif

 

Conclusion

Hope this is clear you to the CombinedGeometry class in WPF.

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.