I am trying to generate random points on the canvas. So i want to the random point on the screen to move to a new random location, when mouse touches it. How do i do this?? this is not happening with any of the mouse events. An example would be appreciated.

Recommended Answers

All 6 Replies

Hi evamshi,
I have posted some questions regarding WPF here but I never got any reply. So I will suggest you to post it in Microsoft Expression forum.
There are many experts of WPF and Silverlight they will help you :)

And please provide more details about your idea/problem of above post.

well i am trying to work with this code http://stackoverflow.com/questions/3643639/move-a-rectangle-around-a-canvas but here the position of the random object is controlled by the buttons and their event handlers....but instead i want to control it using the mouse...i mean when the mouse reaches the object or touches it, the object should move to a new location.....you get it what i am trying to say??

So you want your object to follow your mouse? Or you want to achive anything more?

well let me explain you clearly....i am going to create a random object on the screen and when the mouse touches the object, the object should be relocated to another random location on the screen. This should be in WPF.

Hello evamshi,
I dnt have much time now sorry :(
But luckily last night I created a small application where object follows mouse. I think you are smart enough to modify code little bit :)
So take a look at it I am sure this will help you else will post solution tomorrow. Its in vb.net if you dont know VB.NEt convert that code on this site
:) good luck

This is what you specified now you just need to work on random points generation.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.