Mega Code Archive

 
Categories / VB.Net / WPF
 

Window DragMove

<Window x:Class="GadgetWindow"   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"   Height="300" Width="300"   AllowsTransparency="True" WindowStyle="None" Background="Transparent"   MouseLeftButtonDown="Window_MouseLeftButtonDown">   <Grid>     <Ellipse Fill="Red" Opacity="0.5" Margin="20">       <Ellipse.BitmapEffect>         <DropShadowBitmapEffect/>       </Ellipse.BitmapEffect>     </Ellipse>     <Button Margin="100" Click="Button_Click">Close</Button>   </Grid> </Window> //File:Window.xaml.vb Imports System.Windows Imports System.Windows.Input Public Partial Class GadgetWindow   Inherits Window   Public Sub New()     InitializeComponent()   End Sub   Private Sub Window_MouseLeftButtonDown(sender As Object, e As MouseButtonEventArgs)     Me.DragMove()   End Sub   Private Sub Button_Click(sender As Object, e As RoutedEventArgs)     Me.Close()   End Sub End Class