all groups > vj# > june 2005 >
You're in the

vj#

group:

Help - MouseDrag


Re: Help - MouseDrag George Birbilis [MVP J#] [9880]
6/6/2005 12:00:00 AM
vj#:
[quoted text, click to view]

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@kagi.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
.........................................................................

Help - MouseDrag Sushovan
6/6/2005 9:48:03 AM
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,
--
Re: Help - MouseDrag Sushovan
6/6/2005 12:36:04 PM


[quoted text, click to view]

I am using WinForms.

[quoted text, click to view]

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



[quoted text, click to view]
RE: Help - MouseDrag photon
6/7/2005 12:36:02 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
}
}

AddThis Social Bookmark Button