Thanks, that answers my question---I was hoping there was a property
that I could set to make controls movable, but it looks like you're
suggesting the method (I was hoping) I wouldn't have to use. Thanks, it
works great!
lonnieh wrote:
> I don't know how everybody else does it, but this is how i'd do it.
> I'll have to code this in C# because I don't have a VB.net, but i'm
> sure you'll be able to translate this just fine.
>
> private int _mX; // _mX and _mY hold the
> coordinates
> private int _mY; // when the event _MouseDown fires
>
> private void pictureBox1_MouseMove(object sender,
> System.Windows.Forms.MouseEventArgs e)
> {
> if (e.Button == MouseButtons.Left)
> {
> pictureBox1.Left += e.X - _mX; //(.Left = .Left) + e.X
> - _mX
> pictureBox1.Top += e.Y - _mY;
> }
> }
>
> private void pictureBox1_MouseDown(object sender,
> System.Windows.Forms.MouseEventArgs e)
> {
> if (e.Button == MouseButtons.Left)
> {
> _mX = e.X;
> _mY = e.Y;
> }
> }
>
> looking through the MSDN cds I'd assume that the VB.net equivalent
> would be...
>
>
> [code:1:02070e9725]Private mX as Integer
> Private mY as Integer
>
> Private Sub pictureBox1_MouseDown(sender as Object, e As
> System.Windows.Forms.MouseEventArgs) Handles
> pictureBox1.MouseDown
> If e.Button = MouseButtons.Left Then
> mX = e.X
> mY = e.Y
> End If
> End Sub
>
> Private Sub pictureBox1_MouseMove(sender as Object, e As
> System.Windows.Forms.MouseEventArgs) Handles
> pictureBox1.MouseMove
> If e.Button = MouseButtons.Left Then
> pictureBox1.Left = pictureBox1.Left + e.X - mX
> pictureBox1.Top = pictureBox1.Top + e.Y - mY
> End If
> End Sub[/code:1:02070e9725]
>
> good luck.
>
>
> Posted Via Usenet.com Premium Usenet Newsgroup Services
> ----------------------------------------------------------
> ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
> ----------------------------------------------------------
> http://www.usenet.com
--
==================================================================
Sam J. Marrocco
Sr. Visual Effects Artist/R&D
Travelling Pictures/GTN
Inferno, Flame, Maya, All that cool stuff!
"The fact that no one understands you doesn't make you an artist."
==================================================================
|