Guest User

Untitled

a guest
Jul 20th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.29 KB | None | 0 0
  1. Private Sub GroupBox1_Enter(sender As Object, e As DragEventArgs) Handles DragAndDropGroupBox.DragEnter
  2. e.Effect = DragDropEffects.Copy
  3. Debug.Print("enter")
  4. End Sub
  5.  
  6. Private Sub GroupBox_DragDrop(sender As Object, e As DragEventArgs) Handles DragAndDropGroupBox.DragDrop
  7. Dim obj As dragObject = e.Data.GetData(GetType(dragObject))
  8.  
  9. If obj.type.Equals("textbox") Then
  10. Debug.Print("label")
  11. Dim textBox As New TextBox
  12. textBox.Name = "TextBox" + Convert.ToString(rnd.Next)
  13. DragAndDropGroupBox.Controls.Add(textBox)
  14.  
  15. ElseIf obj.type.Equals("logo") Then
  16. ElseIf obj.type.Equals("qrcode") Then
  17. Dim qrcode As New PictureBox
  18. qrcode.Name = "PictureBox" + Convert.ToString(rnd.Next)
  19. qrcode.Image = My.Resources.qr_code
  20. DragAndDropGroupBox.Controls.Add(qrcode)
  21. End If
  22.  
  23. End Sub
  24.  
  25.  
  26. Private Sub idTextBoxDragHandler(sender As Object, e As MouseEventArgs) Handles idTextBox.MouseDown
  27. Dim width As Integer
  28. Dim height As Integer
  29. Dim fontSize As Integer
  30. Dim truncation As Integer
  31.  
  32. Int32.TryParse(idWidth.Text, width)
  33. Int32.TryParse(idHeight.Text, height)
  34. Int32.TryParse(idFontSize.Text, fontSize)
  35. Int32.TryParse(idTruncation.Text, truncation)
  36.  
  37. Dim obj As New dragObject With
  38. {.width = width,
  39. .height = height,
  40. .fontSize = fontSize,
  41. .truncation = truncation,
  42. .type = "textbox"}
  43.  
  44. idTextBox.DoDragDrop(obj, DragDropEffects.Copy)
  45.  
  46. End Sub
  47.  
  48. Private Sub nameTextBoxDragHandler(sender As Object, e As MouseEventArgs) Handles nameTextBox.MouseDown
  49. Dim width As Integer
  50. Dim height As Integer
  51. Dim fontSize As Integer
  52. Dim truncation As Integer
  53.  
  54. Int32.TryParse(nameWidth.Text, width)
  55. Int32.TryParse(nameHeight.Text, height)
  56. Int32.TryParse(nameFontSize.Text, fontSize)
  57. Int32.TryParse(nameTruncation.Text, truncation)
  58.  
  59. Dim obj As New dragObject With
  60. {.width = width,
  61. .height = height,
  62. .fontSize = fontSize,
  63. .truncation = truncation,
  64. .type = "textbox"}
  65.  
  66. idTextBox.DoDragDrop(obj, DragDropEffects.Copy)
  67.  
  68. End Sub
  69.  
  70. Private Sub descriptionTextBoxDragHandler(sender As Object, e As MouseEventArgs) Handles descriptionTextBox.MouseDown
  71. Dim width As Integer
  72. Dim height As Integer
  73. Dim fontSize As Integer
  74. Dim truncation As Integer
  75.  
  76. Int32.TryParse(descriptionWidth.Text, width)
  77. Int32.TryParse(descriptionHeight.Text, height)
  78. Int32.TryParse(descriptionFontSize.Text, fontSize)
  79. Int32.TryParse(descriptionTruncation.Text, truncation)
  80.  
  81. Dim obj As New dragObject With
  82. {.width = width,
  83. .height = height,
  84. .fontSize = fontSize,
  85. .truncation = truncation,
  86. .type = "textbox"}
  87.  
  88. idTextBox.DoDragDrop(obj, DragDropEffects.Copy)
  89.  
  90. End Sub
  91.  
  92. Private Sub pathTextBoxDragHandler(sender As Object, e As MouseEventArgs) Handles pathTextBox.MouseDown
  93. Dim width As Integer
  94. Dim height As Integer
  95. Dim fontSize As Integer
  96. Dim truncation As Integer
  97.  
  98. Int32.TryParse(pathWidth.Text, width)
  99. Int32.TryParse(pathHeight.Text, height)
  100. Int32.TryParse(pathFontSize.Text, fontSize)
  101. Int32.TryParse(pathTruncation.Text, truncation)
  102.  
  103. Dim obj As New dragObject With
  104. {.width = width,
  105. .height = height,
  106. .fontSize = fontSize,
  107. .truncation = truncation,
  108. .type = "textbox"}
  109.  
  110. idTextBox.DoDragDrop(obj, DragDropEffects.Copy)
  111.  
  112. End Sub
  113.  
  114. Private Sub logoDragHandler(sender As Object, e As MouseEventArgs) Handles logoDrag.MouseDown
  115. Dim width As Integer
  116. Dim height As Integer
  117.  
  118. Int32.TryParse(logoWidth.Text, width)
  119. Int32.TryParse(logoHeight.Text, height)
  120.  
  121. Dim obj As New dragObject With
  122. {.width = width,
  123. .height = height,
  124. .type = "logo"}
  125.  
  126. idTextBox.DoDragDrop(obj, DragDropEffects.Copy)
  127.  
  128. End Sub
  129.  
  130.  
  131. Private Sub QRCodeDragHandler(sender As Object, e As MouseEventArgs) Handles QRCodeDrag.MouseDown
  132. Dim width As Integer
  133. Dim height As Integer
  134.  
  135. Int32.TryParse(qrCodeWidth.Text, width)
  136. Int32.TryParse(qrCodeHeight.Text, height)
  137.  
  138. Dim obj As New dragObject With
  139. {.width = width,
  140. .height = height,
  141. .type = "qrcode"}
  142.  
  143. QRCodeDrag.DoDragDrop(obj, DragDropEffects.Copy)
  144. End Sub
  145.  
  146. Dim textBox As New TextBox
  147. textBox.Name = "TextBox" + Convert.ToString(rnd.Next)
  148. textBox.Location = DragAndDropGroupBox.PointToClient(New Point(e.X, e.Y))
  149. DragAndDropGroupBox.Controls.Add(textBox)
Add Comment
Please, Sign In to add comment