HighTechTalks DotNet Forums  

Help - MouseDrag

Dotnet VJSharp microsoft.public.dotnet.vjsharp


Discuss Help - MouseDrag in the Dotnet VJSharp forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Sushovan
 
Posts: n/a

Default Help - MouseDrag - 06-06-2005 , 12:48 PM






Hi,
I am trying to make a Scribble application in VJ# using .NET event
handlers. I made a form, added a picture box to it, created a Bitmap object
and set it as it's "Image" property.
Now, I have event-handlers for MouseDown, MouseUp, and MouseClick, but
what about MouseDrag ? I need MouseDrag because I would be scribbling with
the mouse button on hold.
None of the event handlers under "Drag-and-Drop" category seems to be
right for this purpose.
Please help me with this problem, as I was about to make this small app a
part of a bigger application with more functionality.

Thanks,
--
Sushovan, a crazy junior

Reply With Quote
  #2  
Old   
George Birbilis [MVP J#] [9880]
 
Posts: n/a

Default Re: Help - MouseDrag - 06-06-2005 , 01:10 PM






Quote:
I am trying to make a Scribble application in VJ# using .NET event
handlers. I made a form, added a picture box to it, created a Bitmap
object
and set it as it's "Image" property.
Now, I have event-handlers for MouseDown, MouseUp, and MouseClick, but
what about MouseDrag ? I need MouseDrag because I would be scribbling with
the mouse button on hold.
None of the event handlers under "Drag-and-Drop" category seems to be
right for this purpose.
Please help me with this problem, as I was about to make this small app
a
part of a bigger application with more functionality.
are you using WinForms or Swing?

on Swing you have MouseListener and MouseMotionListener. Only the second has
MouseMove and MouseDrag methods. So you have to use addMouseMotionListener
method

on WinForms, maybe you just watch for MouseMove events and see if the mouse
key you are interested in is down during the mouse motion (also watch for
MouseUp events in case user releases the mouse button without moving the
mouse after that)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
George Birbilis <birbilis (AT) kagi (DOT) com>
Microsoft Most Valuable Professional
MVP J# for 2004, 2005
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ QuickTime (Delphi & ActiveX: VB, PowerPoint, .NET)
+ Plugs (InterProcess/Internet communication)
http://www.kagi.com/birbilis
+ Robotics
http://www.mech.upatras.gr/~robgroup
.................................................. .......................




Reply With Quote
  #3  
Old   
Sushovan
 
Posts: n/a

Default Re: Help - MouseDrag - 06-06-2005 , 03:36 PM





Quote:
are you using WinForms or Swing?
I am using WinForms.

Quote:
on WinForms, maybe you just watch for MouseMove events and see if the mouse
key you are interested in is down during the mouse motion (also watch for
MouseUp events in case user releases the mouse button without moving the
mouse after that)
Will this not affect the Application's performance? As it is, it handles
large objects like Bitmaps. I wish there was a better way, but if this is the
only one, I will use this.

Thank you for the solution. I am in the process of implementing it.
--
Sushovan, a crazy junior



Quote:
on Swing you have MouseListener and MouseMotionListener. Only the second has
MouseMove and MouseDrag methods. So you have to use addMouseMotionListener
method



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
George Birbilis <birbilis (AT) kagi (DOT) com
Microsoft Most Valuable Professional
MVP J# for 2004, 2005
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ QuickTime (Delphi & ActiveX: VB, PowerPoint, .NET)
+ Plugs (InterProcess/Internet communication)
http://www.kagi.com/birbilis
+ Robotics
http://www.mech.upatras.gr/~robgroup
.................................................. .......................




Reply With Quote
  #4  
Old   
photon
 
Posts: n/a

Default RE: Help - MouseDrag - 06-07-2005 , 03:36 AM



You might want to use the MouseEventArgs's button property to check for drag
during MouseMove event - that might help--

protected override void OnMouseMove (MouseEventArgs e)

{
if (e.Button==MouseButton.Left)
{
// do your drag stuff
}
}

The above code essentially acts like a drag event handler

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.