R
Roger.Smith
Overview:
I have been creating custom shaped forms using a bitmap to set the form's
region. This has worked well, and I have had a lot of success finding
resources to help out. However, most of the examples that I have located
have been stand-alone forms, where the single form is the entire
application. What I need is to create custom shaped forms, and use them as
child forms inside of a MDI Container form. Getting this custom shaped
forms to be MDI children is not a problem, however moving them is.
Statement of the Problem.
The problem that I am having specifically is that when I place code on the
form to move it (in responce to a mouse clicking and dragging the form), the
form jumps down as soon as I begin to drag the form. My logic looks like
this (in the child form):
In the header.........
Private pntPointClicked As Point
Mouse Down Event.......
Private Sub frmIrregular_MouseDown(...) Handles MyBase.MouseDown
blnFormDragging = True
pntPointClicked = New Point(-e.X, -e.Y)
End Sub
Mouse Move Event.......
Private Sub frmIrregular_MouseMove(...) Handles MyBase.MouseMove
If blnFormDragging Then
Dim aMoveToPoint As Point
' Use the current mouse position to find the target location.
aMoveToPoint = Control.MousePosition
' Adjust the position based on where you started.
aMoveToPoint.Offset(pntPointClicked.X, pntPointClicked.Y)
' Try to account for the MDI Container not being in the upper left
of the screen.
aMoveToPoint.Offset(-Me.ParentForm.Location.X, -Me.ParentForm.Location.Y
)
' Move the form.
Me.Location = aMoveToPoint
End If
End Sub
Mouse Up Event.......
Private Sub frmIrregular_MouseUp(...) Handles MyBase.MouseUp
blnFormDragging = False
End Sub
What I need is some code to move the form when I click on the form (not a
control on the form), that doesn't cause the form to jump when the dragging
begins, and that accounts for the form being an MDI Child.
Thanks for the help,
Roger
I have been creating custom shaped forms using a bitmap to set the form's
region. This has worked well, and I have had a lot of success finding
resources to help out. However, most of the examples that I have located
have been stand-alone forms, where the single form is the entire
application. What I need is to create custom shaped forms, and use them as
child forms inside of a MDI Container form. Getting this custom shaped
forms to be MDI children is not a problem, however moving them is.
Statement of the Problem.
The problem that I am having specifically is that when I place code on the
form to move it (in responce to a mouse clicking and dragging the form), the
form jumps down as soon as I begin to drag the form. My logic looks like
this (in the child form):
In the header.........
Private pntPointClicked As Point
Mouse Down Event.......
Private Sub frmIrregular_MouseDown(...) Handles MyBase.MouseDown
blnFormDragging = True
pntPointClicked = New Point(-e.X, -e.Y)
End Sub
Mouse Move Event.......
Private Sub frmIrregular_MouseMove(...) Handles MyBase.MouseMove
If blnFormDragging Then
Dim aMoveToPoint As Point
' Use the current mouse position to find the target location.
aMoveToPoint = Control.MousePosition
' Adjust the position based on where you started.
aMoveToPoint.Offset(pntPointClicked.X, pntPointClicked.Y)
' Try to account for the MDI Container not being in the upper left
of the screen.
aMoveToPoint.Offset(-Me.ParentForm.Location.X, -Me.ParentForm.Location.Y
)
' Move the form.
Me.Location = aMoveToPoint
End If
End Sub
Mouse Up Event.......
Private Sub frmIrregular_MouseUp(...) Handles MyBase.MouseUp
blnFormDragging = False
End Sub
What I need is some code to move the form when I click on the form (not a
control on the form), that doesn't cause the form to jump when the dragging
begins, and that accounts for the form being an MDI Child.
Thanks for the help,
Roger