Advertisement
jsbsan

Arrastrar y Soltar

Apr 15th, 2014
1,611
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GAMBAS 1.20 KB | None | 0 0
  1. ' Gambas class file
  2.  
  3. Public Sub _new()
  4.  
  5. End
  6.  
  7. Public Sub Form_Open()
  8.  
  9.   PictureBoxSoltar.Drop = True
  10.   PictureBox1.tag = "cb.png"
  11.   PictureBox1.picture = Picture["cb.png"]
  12.  
  13.   PictureBox2.tag = "ce.png"
  14.   PictureBox2.picture = Picture["ce.png"]
  15.  
  16.   PictureBox3.tag = "co.png"
  17.   PictureBox3.picture = Picture["co.png"]
  18.  
  19.   PictureBox4.tag = "cc.png"
  20.   PictureBox4.picture = Picture["cc.png"]
  21.  
  22.   Drag.icon = Picture["drop.png"] 'icono que muetra cuando arrastramos algo.
  23.  
  24. End
  25.  
  26. 'cuando suelto, cargo la imagen que indica el path guardado en el objeto drag
  27. Public Sub PictureBoxSoltar_Drop()
  28.  
  29.   PictureBoxSoltar.Picture = Picture[Drag.data]
  30.  
  31. End
  32.  
  33. '
  34. 'Uso el método drag para informar que dato es arrastrado si pulso en el control
  35. Public Sub PictureBox1_MouseDrag()
  36.  
  37.   PictureBox1.Drag(PictureBox1.tag)
  38.  
  39. End
  40.  
  41. Public Sub PictureBox2_MouseDrag()
  42.  
  43.   PictureBox2.Drag(PictureBox2.tag)
  44.  
  45. End
  46.  
  47. Public Sub PictureBox3_MouseDrag()
  48.  
  49.   PictureBox3.Drag(PictureBox3.tag)
  50.  
  51. End
  52.  
  53. Public Sub PictureBox4_MouseDrag()
  54.  
  55.   PictureBox4.Drag(PictureBox4.tag)
  56.  
  57. End
  58.  
  59. 'defino el icono del mouse mientras arrastro algo....
  60. Public Sub Form_DragMove()
  61.  
  62.   Drag.Show()
  63.  
  64. End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement