I need to move a borderless form, and have tried using the form's
mousedown/mousemove events. While I'm able to move the form, it flashes
like crazy, and it's not 100% accurate. Here's the code I'm using ... any
help would be appreciated. I'm sure I'm missing some very simple.
Private Sub frmViewer_MouseDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
blnMoving = True
origLoc.X = Me.Location.X
origLoc.Y = Me.Location.Y
origX = e.X
origY = e.Y
End Sub
Private Sub frmViewer_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
If blnMoving = True Then
newloc.X = origLoc.X + (Screen.PrimaryScreen.Bounds.X - origX)
newloc.Y = origLoc.Y + (Screen.PrimaryScreen.Bounds.Y - origY)
If Me.Location.X <> newloc.X Or Me.Location.Y <> newloc.Y Then
Me.Location = newloc
End If
End If
End Sub
Private Sub frmViewer_MouseUp(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
blnMoving = False
newloc.X = newloc.X
newloc.Y = newloc.Y
Me.Location = newloc
End Sub
You might try this. It works for me without flicker.
http://www.avenuezx.com/VBnet4apps/tips/2.htm
----
VBnet4Apps
http://www.avenuezx.com/vbnet4apps/
THank you! Thank You! Thank You!
"VBnet4Apps" <VBnet4Ap...@avenuezx.com> wrote in message
news:#KecQXwQCHA.2520@tkmsftngp10...
HTH
--
Corrado Cavalli
UGIdotNET - http://www.ugidotnet.org
That's really cool code! Now if I could just understand why/how it works,
I'd really be happy!
Thanks much!
Terry
"Corrado Cavalli" <cor...@corrado.com> wrote in message
news:eCv$eLxQCHA.2632@tkmsftngp10...