• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3701
  • Last Modified:

Moving Objects in C#

Hello Experts,

I am relatively new to the C3/dot net world (have been in Java and legacy languages).  Can anyone give me a basic example (or point me to a really good article) describing how to dynamically move objects on a Form?

For instnace, I have 2 circles on the form.  When I move one circle down, I want the other circle to move down the same distance (so that they are right across from each other).  I would also like an example of how to move them in opposite directions of each other (whether by the same distance or random distance).

A client side example, along with a web based example, would be appreciated.

Thanks!
0
mossman243
Asked:
mossman243
  • 2
1 Solution
 
anarki_jimbelCommented:
I'd say the question is a bit vague. Is your circle an object? If you do not just draw this circle on a form but instead create a custom control, probably that's easier.

Controls have a number of events that may help with the task, e.g. LocationChanged etc. If you drag a control with a mouse you may use MouseDown and MouseUp events etc.

Could you pls state your task in more details?
0
 
mossman243Author Commented:
Yes, I think a control might work.  If memory serves me correct from the old VB days, that was a method to do it.

My task will eventually be to move several objects/controls to a location on the form based on the position of one object/control.  (i.e. if one object is in the top left corner, the other 2 objects are in the lower right corner, etc) Again, if memory serves me correct, I seem to remember having to calculate new xy coordinates for the dependent objects whenever the control object changed in VB, but I am not sure how to do this in C#.

Hope this helps

0
 
anarki_jimbelCommented:
Really you task is not very simple one. I'd say, in Java it'd be probably easier.

Anyway, look at:
http://www.bobpowell.net/manipulate_graphics.htm
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now