Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 11
  1. #1

    (vb-net) >Drag Drop

    raga.. mi sono impallato..

    cerco di far migrare un imagine da una picturebox a un altra ma dimentico qualcosa,

    codice:
    Public Class Form1    
     Dim immagine As Image 
         
    Private Sub Form1_Load
             immagine = uno.Image    
      End Sub 
    
      
       Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles uno.MouseDown 
    
    
            draga()    
        End Sub
         
         Public Sub draga()    
            uno.DoDragDrop(imagine, DragDropEffects.Move)    
          End Sub  
    
             Private Sub picturebox2_Dragover(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles due.DragEnter  
        picturebox2.Image = immagine     
            End Sub End Class

  2. #2
    Utente di HTML.it L'avatar di Mychy
    Registrato dal
    Oct 2000
    Messaggi
    794
    Prova con:
    codice:
    picturebox2.Image=e.Data.GetDate(dataFormats.Bitmat)
    io l'ho messo sull'evento DragDrop ma dovrebbe andare bene

  3. #3

    dove?

    non ho capito dove metterlo

  4. #4
    Utente di HTML.it L'avatar di Mychy
    Registrato dal
    Oct 2000
    Messaggi
    794
    Io l'ho messo in Private Sub picturebox2_DragDrop

    ma dovrebbe andare bene anche in:

    Private Sub picturebox2_Dragover

  5. #5

    non va

    non va ,anche se sembra volerlo fare
    cioe picturebox1 e abilitato a drag lo vedo quando clikko,mi fermo nella due e non succede niente

    codice:
    Public Class Form1    
     Dim imagine As Image  
       
     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load     
     
       imagine =picturebox1.Image   
    
       End Sub       
    
        Public Sub draga()  
           uno.DoDragDrop(imagine, DragDropEffects.Copy)    
     End Sub  
       
     Private Sub uno_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles uno.MouseDown 
           
     draga()
    
          End Sub 
    
        Private Sub due_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles due.DragDrop
    
     picturebox2.Image = e.Data.GetData(DataFormats.Bitmap)    
    
       End Sub

  6. #6
    Utente di HTML.it L'avatar di Mychy
    Registrato dal
    Oct 2000
    Messaggi
    794
    Questo l'ho appena provato e funziona correttamente
    codice:
    Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
            PictureBox1.DoDragDrop(PictureBox1.Image, DragDropEffects.All)
        End Sub
    
        Private Sub PictureBox2_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles PictureBox2.DragDrop
            PictureBox2.Image = e.Data.GetData(DataFormats.Bitmap)
        End Sub
        
    
        Private Sub PictureBox2_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles PictureBox2.DragEnter
            e.Effect = DragDropEffects.Copy
    End Sub

  7. #7

    niente

    codice:
     cosi come il tuo 
    uno = picturebox1 due = picturebox2
    ma non va .
    
    
    Public Class Form1    
       Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load     
      End Sub      
         
    
        Private Sub uno_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles uno.MouseDown
           
      uno.DoDragDrop(uno.Image, DragDropEffects.All)  
    
        End Sub
    
          Private Sub due_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles due.DragDrop  
    
           due.Image = e.Data.GetData(DataFormats.Bitmap)    
       End Sub   
          
      Private Sub due_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles due.DragEnter   
          e.Effect = DragDropEffects.Copy    
     End Sub
    
     End Class

  8. #8
    Utente di HTML.it L'avatar di Mychy
    Registrato dal
    Oct 2000
    Messaggi
    794
    due è abilitato al drag&Drop?

    Io uso net Framework 3.5

    Non va... ti da un errore in particolare?

  9. #9

    non so

    io uso anche il 3.5

    come abilito il drag ?

  10. #10
    Utente di HTML.it L'avatar di Mychy
    Registrato dal
    Oct 2000
    Messaggi
    794
    due.AllowDrop=True

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.