|
-
May 11th, 2010, 01:27 AM
#2
Re: Basic c# question for my assignment
You need to build up a list of the points that the circle as been to. Then in your Paint event handler, rather than just drawing the ellipse at x1, y1, you loop around all of the points drawing an ellipse at each....
Code:
// class members
private List<Point> _points = new List<Point>();
private Int32 _x = 50;
private Int32 _y = 50;
// paint handler
Graphics graphics = e.Graphics;
foreach (Point point in _points)
graphics.FillEllipse(Brushes.Blue, point.X, point.Y, 20, 20)
// in your process command...
if (input == "Down")
{
_y += 10;
// add the new point to the list
_points.Add(new Point(_x, _y);
// ... as before
}
You can now also easily implement a [Shake] button by simply calling:
_points.Clear();
and then refreshing....
Rob
-
Ohhhhh.... Old McDonald was dyslexic, E O I O EEEEEEEEEE.......
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|