所以我有一个Panel
和一个GroupBox
。我对其进行了编码,以便可以将图片从Panel
拖到GroupBox
并放在此处。问题是我只能在GroupBox
中添加1张图片,我想添加任意数量的图片,并且在将图片放置在GroupBox
中时还要调整图片的大小,以使其小于实际尺寸。在Panel
中。
Private Sub Panel1_MouseDown(sender As Object, e As MouseEventArgs) Handles Panel1.MouseDown
Panel1.DoDragDrop(Panel1.BackgroundImage, DragDropEffects.Copy)
End Sub
Private Sub view1_DragEnter(sender As Object, e As DragEventArgs) Handles view1.DragEnter
If (e.Data.GetDataPresent(DataFormats.Bitmap)) Then
e.Effect = DragDropEffects.Copy
End If
End Sub
Private Sub view1_DragDrop(sender As Object, e As DragEventArgs) Handles view1.DragDrop
Dim bm As Bitmap = DirectCast(e.Data.GetData(DataFormats.Bitmap), Bitmap)
view1.BackgroundImage = bm
End Sub