I've this:
vb Code:
Public Class PreviewFrm
Dim worker As MoveResizeControl.controlHandler
'Declarar controlo
Dim btn As New Button With { _
.Width = 200, _
.Height = 200, _
.Left = 10, _
.Top = 10, _
.Text = "Nova caixa de informação", _
.BackColor = Color.Transparent, _
.FlatStyle = FlatStyle.Popup}
Private Sub PreviewFrm_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
worker.deselectAll()
Invalidate()
End Sub
Private Sub PreviewFrm_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
If worker.boundingRectangle <> Nothing Then
Dim p As New Pen(Color.Black, 1)
p.DashStyle = Drawing2D.DashStyle.Dash
e.Graphics.DrawRectangle(p, worker.boundingRectangle)
End If
End Sub
Private Sub PreviewFrm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Inicializar DLL do Resize e movimento de controlos dinâmicos
worker = New MoveResizeControl.controlHandler
worker.boundControls.Add(New MoveResizeControl.controlHandler.boundControl(Me, btn))
worker.bindControls()
Me.Width = My.Computer.Screen.Bounds.Width
Me.Height = My.Computer.Screen.Bounds.Height
End Sub
Private Sub btn_config_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_config.Click
ConfigDesignForm.Show()
End Sub
Private Sub btn_additems_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_additems.Click
Me.Controls.Add(btn)
btn.BringToFront()
End Sub
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?