Non-Rectangular window
<Window x:Class="Windows.TransparentWithShapes"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="NonRectangularWindowSample" Width="210" Height="170"
WindowStyle="None" AllowsTransparency="True" Background="Transparent">
<Grid>
<Path Stroke="DarkGray" StrokeThickness="1" SnapsToDevicePixels="True">
<Path.Fill>
<LinearGradientBrush StartPoint="0.2,0" EndPoint="0.8,1" >
<LinearGradientBrush.GradientStops>
<GradientStop Color="White" Offset="0"></GradientStop>
<GradientStop Color="White" Offset="0.45"></GradientStop>
<GradientStop Color="LightBlue" Offset="0.9"></GradientStop>
<GradientStop Color="Gray" Offset="1"></GradientStop>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Path.Fill>
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigure StartPoint="20,0" IsClosed="True">
<LineSegment Point="140,0"></LineSegment>
<ArcSegment Point="160,20" Size="20,20" SweepDirection="Clockwise"></ArcSegment>
<LineSegment Point="160,60"></LineSegment>
<ArcSegment Point="140,80" Size="20,20" SweepDirection="Clockwise"></ArcSegment>
<LineSegment Point="70,80"></LineSegment>
<LineSegment Point="20,80"></LineSegment>
<ArcSegment Point="20,0" Size="20,20" SweepDirection="Clockwise"></ArcSegment>
</PathFigure>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
<Path.RenderTransform>
<ScaleTransform ScaleX="1.3" ScaleY="1.3"></ScaleTransform>
</Path.RenderTransform>
</Path>
<StackPanel Margin="5">
<Button HorizontalAlignment="Right" Click="cmdClose_Click" Margin="0,5,10,0">x</Button>
</StackPanel>
</Grid>
</Window>
//File:Window.xaml.vb
Imports System
Imports System.Windows
Imports System.Windows.Input
Namespace Windows
Public Partial Class TransparentWithShapes
Inherits Window
Public Sub New()
InitializeComponent()
End Sub
Private Sub window_MouseLeftButtonDown(sender As Object, e As MouseButtonEventArgs)
Me.DragMove()
End Sub
Private Sub cmdClose_Click(sender As Object, e As RoutedEventArgs)
Me.Close()
End Sub
End Class
End Namespace
Related examples in the same category