منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
[VB.NET] سحب صورة من مجلد إلى picture box - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : قسم لغة الفيجوال بيسك VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=182)
+--- قسم : قسم اسئلة VB.NET (http://vb4arb.com/vb/forumdisplay.php?fid=183)
+--- الموضوع : [VB.NET] سحب صورة من مجلد إلى picture box (/showthread.php?tid=38291)



سحب صورة من مجلد إلى picture box - sayyad - 15-04-21

أريد المساعدة : كيف أنقل صورة من مجلد إلى أداة  picture box بواسطة السحب والافلات
مشكورين أصدقائي..


RE: سحب صورة من مجلد إلى picture box - asmarsou - 16-04-21

(15-04-21, 01:15 AM)sayyad كتب : أريد المساعدة : كيف أنقل صورة من مجلد إلى أداة  picture box بواسطة السحب والافلات
مشكورين أصدقائي..

تفضل اخي الكريم
كود :
Public Class Form1

   Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load

       PictureBox1.AllowDrop = True

   End Sub

   Private Sub PictureBox1_DragDrop(ByVal sender As Object, ByVal e As DragEventArgs) Handles PictureBox1.DragDrop
       Dim strDragDrop As String() = CType(e.Data.GetData(DataFormats.FileDrop), String())
       For Each fileneve As String In strDragDrop
           PictureBox1.ImageLocation = fileneve
       Next
   End Sub

   Private Sub PictureBox1_DragEnter(ByVal sender As Object, ByVal e As DragEventArgs) Handles PictureBox1.DragEnter
       If e.Data.GetDataPresent(DataFormats.FileDrop) Then
           e.Effect = DragDropEffects.Copy
       End If
   End Sub

End Class



RE: سحب صورة من مجلد إلى picture box - messry - 16-04-21

(16-04-21, 12:01 AM)asmarsou كتب :
(15-04-21, 01:15 AM)sayyad كتب : أريد المساعدة : كيف أنقل صورة من مجلد إلى أداة  picture box بواسطة السحب والافلات
مشكورين أصدقائي..

تفضل اخي الكريم
كود :
Public Class Form1

   Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load

       PictureBox1.AllowDrop = True

   End Sub

   Private Sub PictureBox1_DragDrop(ByVal sender As Object, ByVal e As DragEventArgs) Handles PictureBox1.DragDrop
       Dim strDragDrop As String() = CType(e.Data.GetData(DataFormats.FileDrop), String())
       For Each fileneve As String In strDragDrop
           PictureBox1.ImageLocation = fileneve
       Next
   End Sub

   Private Sub PictureBox1_DragEnter(ByVal sender As Object, ByVal e As DragEventArgs) Handles PictureBox1.DragEnter
       If e.Data.GetDataPresent(DataFormats.FileDrop) Then
           e.Effect = DragDropEffects.Copy
       End If
   End Sub

End Class

ما شاء الله
ممتاز بارك الله فيك