Imports System.IO Imports System.Drawing Imports System.Drawing.Drawing2D Public Class Form1 Private oldRegion, newRegion As Region Private oldImage, newImage As Image Private Sub Form1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.DoubleClick Me.Close() End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None Me.AllowDrop = True Me.TopMost = True oldRegion = Me.Region oldImage = Me.BackgroundImage End Sub Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As FormClosedEventArgs) Handles Me.FormClosed If newRegion IsNot Nothing Then Me.Region = oldRegion newRegion.Dispose() End If If newImage IsNot Nothing Then Me.BackgroundImage = oldImage newImage.Dispose() End If End Sub Private Sub Form1_DragOver(ByVal sender As Object, ByVal e As DragEventArgs) Handles Me.DragOver If e.Data.GetDataPresent(DataFormats.FileDrop) Then e.Effect = DragDropEffects.Copy End If End Sub Private Sub Form1_DragDrop(ByVal sender As Object, ByVal e As DragEventArgs) Handles Me.DragDrop If e.Data.GetDataPresent(DataFormats.FileDrop) Then Me.AllowDrop = False Dim dropFiles() As String = e.Data.GetData(DataFormats.FileDrop) newImage = New Bitmap(dropFiles(0)) Me.ClientSize = newImage.Size Me.BackgroundImage = newImage ' http://smdn.invisiblefulmoon.net/mnemorepos/20040229-00.html newRegion = CreateRegionFromImage(newImage, Color.Transparent) Me.BackgroundImage = newImage Me.Region = newregion End If End Sub End Class