I've this:

vb Code:
  1. Public Class PreviewFrm
  2.  
  3.     Dim worker As MoveResizeControl.controlHandler
  4.  
  5.     'Declarar controlo
  6.     Dim btn As New Button With { _
  7.        .Width = 200, _
  8.        .Height = 200, _
  9.        .Left = 10, _
  10.        .Top = 10, _
  11.        .Text = "Nova caixa de informação", _
  12.        .BackColor = Color.Transparent, _
  13.        .FlatStyle = FlatStyle.Popup}
  14.  
  15.     Private Sub PreviewFrm_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
  16.         worker.deselectAll()
  17.         Invalidate()
  18.     End Sub
  19.  
  20.  
  21.     Private Sub PreviewFrm_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
  22.         If worker.boundingRectangle <> Nothing Then
  23.             Dim p As New Pen(Color.Black, 1)
  24.             p.DashStyle = Drawing2D.DashStyle.Dash
  25.             e.Graphics.DrawRectangle(p, worker.boundingRectangle)
  26.         End If
  27.     End Sub
  28.  
  29.     Private Sub PreviewFrm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  30.         ' Inicializar DLL do Resize e movimento de controlos dinâmicos
  31.         worker = New MoveResizeControl.controlHandler
  32.         worker.boundControls.Add(New MoveResizeControl.controlHandler.boundControl(Me, btn))
  33.         worker.bindControls()
  34.  
  35.  
  36.         Me.Width = My.Computer.Screen.Bounds.Width
  37.         Me.Height = My.Computer.Screen.Bounds.Height
  38.  
  39.     End Sub
  40.  
  41.     Private Sub btn_config_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_config.Click
  42.         ConfigDesignForm.Show()
  43.     End Sub
  44.  
  45.     Private Sub btn_additems_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_additems.Click
  46.         Me.Controls.Add(btn)
  47.         btn.BringToFront()
  48.     End Sub
  49. End Class

Well, now I've changed somethings. I declared the object first.

Now I've another problem. While "moving" or "resizing", it 'crashes'. Imagine that I'm moving it, it moves something like 10pixels, stay with the hand cursor, but it 'crashes' there. Don't happen anything more. It freezes. Suggestions?