tags:

views:

53

answers:

2

I have found this analog clock tutorial here:

http://www.codeproject.com/KB/selection/AnalogClockControl.aspx

Now is it possible to drag and drop the hand hour (how to detect the mouse on the hand hour ?) and show this hand hour moving while dragging it ?

I mean isn't anything included framework in .NET which allow me to detect that the mouse is ON a shape like for IPHONE sdk ?

+1  A: 

I would suggest you to use what is called "Rx": reactive extensions, all you want you can do without it, but Rx makes your life better and easier :)

There is an Rx for .NET and Rx for Javascript, same stuff and you can have similar techniques wherever you want.

Here is a nice video how to do drag-n-drop using Rx in .NET (WPF in this example) and even if you do something else (winforms, silverlight, javascript) - watch this video anyway, it gives you the idea and the implementation is exactly the same for everything else: http://channel9.msdn.com/blogs/j.van.gogh/writing-your-first-rx-application

And here is a javascript specific drag-n-drop using Rx described: http://weblogs.asp.net/podwysocki/archive/2010/03/19/introduction-to-the-reactive-extensions-for-javascript-drag-and-drop.aspx

Patrol02
Rx is interesting but I'm not sure in this case it will solve my problem which is to detect the mouse OVER the shape ?
+2  A: 

You can do it if you draw the hands with the GraphicsPath class. Its IsVisible() method lets you implement hit-testing in the MouseDown event and detect that the mouse is over a hand.

Hans Passant
Excellent that's exactly what I was looking for, thanks!