منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : السحب والاسقاط من اداة picturebox الى مجلد مفتوح
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
سلام

السحب والاسقاط من اداة picturebox الى مجلد مفتوح مباشرة windows explorer.

هذا مثال لطريقة سحب صورة من اداة الصور picturebox الى اي مجلد مفتوح explorer.

كود :
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

   PictureBox1.AllowDrop = True

End Sub

Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
   If (e.Button = MouseButtons.Left) Then
       Dim filename As String = IO.Path.GetTempPath & "\" & "image.jpg"
       PictureBox1.Image.Save(filename, Imaging.ImageFormat.Jpeg)
       DoDragDrop(New DataObject(DataFormats.FileDrop, New String() {filename}), DragDropEffects.Move)
   End If
End Sub

Private Sub PictureBox1_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles PictureBox1.DragEnter
   e.Effect = e.AllowedEffect
End Sub

في المرفقات مشروع جاهز

موفقين