moving the form

G

Guest

hey all,
is there a way to have it where if a user clicks and holds down left mouse
button on a TextBox they will be able to move the form around the desktop?

thanks,
rodchar
 
G

Guest

yea...look at the textbox's mousedown and mousemove events.....but this is a
very curious question....can i ask the purpose of this?
 
G

Guest

ok, so its something like this

''GLobal Var
Private ptOld as Point

Private boolDown as Boolean = False

Private Sub txtStuff_MouseDown(..)

If e.Button = MouseButtons.Left then

ptOld.X = e.x
ptOld.Y = e.y

boolDown = true

end if

end sub


Private SUb txtStuff_MouseMove(.,..)

if boolDown then

Me.left = ptOld.X - e.x
Me.Top = ptOld.Y - e.Y

end if

end sub


Private Sub txtStuff_MouseUp(...)

boolDown = false

end sub



something along those lines

hope this helps
 
G

Guest

Shouldn't that be:

Me.left = Me.left + ptOld.X - e.x
Me.Top = Me.Left + ptOld.Y - e.Y
Me.Refresh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

window frame 3
run form without this 2
always on top 3
form image 4
msdn.vb.lang forum grid 10
publisher file 5
task manager inquiry 6
temp directory 3

Top