CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Moving objects

  1. #1
    Join Date
    Feb 2010
    Posts
    3

    Moving objects

    Hi everyone,

    I've been learning C# for a couple of months now, and I've ran into a problem.

    I've drawn a Circle (FillEllipse) with the Paint-event. Now, I'd like the circle to move around in a specific area.

    Is there an easy way I can make the circle move around (randomly), and bounce off panel "walls"?

    Greetings,
    Tom

  2. #2
    Join Date
    Dec 2009
    Posts
    22

    Re: Moving objects

    I haven't really worked with it, but WPF together with Expression Blend, could make your life a little easier.

    Expression Blend is a Microsoft program for designers, et enables you to animate and completely customize the WPF controls. You should check it out.

  3. #3
    Join Date
    Feb 2010
    Posts
    3

    Re: Moving objects

    Thanks for sharing

    Unfortunately, I'm bound to use only C#, without any add-ons / plug-ins..
    So I really need something that I can get directly from C# / .NET..

    Sorry to be such a pain

  4. #4
    Join Date
    Dec 2009
    Posts
    22

    Re: Moving objects

    WPF is .NET, i think it was added in .NET 3.5.

    It's just an alternative to the normal forms. You can edit the design of the forms with XML, much like you would edit a web page with HTML.

    If you are using visual studio there is a project template for WPF, and Expression Blend integrates quite well with visual studio. (right click a desig-file as choose edit in expression blend)

    Take a look at this article: http://www.codeproject.com/KB/WPF/WPFAnimation.aspx
    It explains how to do animations in WPF
    Last edited by jonlist; February 7th, 2010 at 07:33 PM.

  5. #5
    Join Date
    Feb 2010
    Posts
    3

    Re: Moving objects

    Found it!

    Thanks a lot

  6. #6
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Moving objects

    Please specify what version of .NET you are using in future, as explained here :

    http://www.codeguru.com/forum/showthread.php?t=401115


  7. #7
    Join Date
    Dec 2007
    Location
    Brazil
    Posts
    37

    Re: Moving objects

    Create a timer.
    At each timer event:
    - change the coordinates of your circle,
    - invalidate the control you are drawing on.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured