I have put a background picture in a panel and now i want to drag and drop bitmap images on it.how do i accomplish that?

7 Years
Discussion Span
Last Post by Nada_ward

do you want set it as background for banel after dropping ??
from what you will drag image ?? picture box or outside programm ??


Please see this thread regarding to drag and drop:

Here is another thread in C# if you can port the code:

The VB code provided:

Public Class FormDragDrop

	Private Sub FormDragDrop_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		Me.AllowDrop = True
	End Sub

	Private Sub FormDragDrop_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragEnter
		If (e.Data.GetDataPresent(DataFormats.FileDrop)) Then
			e.Effect = DragDropEffects.Copy
		End If
	End Sub

	Private Sub FormDragDrop_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles MyBase.DragDrop
		Dim handle As String() = e.Data.GetData(DataFormats.FileDrop, False)
		If (handle.Length > 0) Then
			If (System.IO.File.Exists(handle(0))) Then
				Me.BackgroundImage = Bitmap.FromFile(handle(0))
			End If
		End If
	End Sub
End Class

You will want to modify the code above to veryify that Bitmap.FromFile() does not throw an exception if a non-image type resource is dragged on to your panel.


from another panel overlay with pictures.that what i'm trying to do .i have not found a way to do that overlaying also.plz help me if you can


set the overlay of picture by photoshop CS
than set it as background
if u want me to set your picture ,send it to me or put it here as attachment ..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.