Non-Rectangular window : Window Style « Windows Presentation Foundation « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » Windows Presentation Foundation » Window Style 
16.59.2.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
WPF Non Rectangular Window
16.59.Window Style
16.59.1.Change window cursorChange window cursor
16.59.2.Non-Rectangular windowNon-Rectangular window
16.59.3.Transparent WindowTransparent Window
16.59.4.Create a non-rectangular windowCreate a non-rectangular window
16.59.5.Windows Transparent BackgroundWindows Transparent Background
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.