15,963,724 members
See more: , +
Draw two circles with the mouse on picturebox. When lowering the mouse, the center of the circle is set, and when released, its radius set. The coordinates of the center of the circles and their radii are displayed on the form (in Cartesian CS).
Determine the mutual arrangement of circles (coincide, intersect, touch or have no common points).
Create the ability to move the circles with the mouse.

What I have tried:

C#
```void Circle(Graphics g)
{
for (int i = 0; i < Pnt.Count; i += 2)
{
int dx = Pnt[i].X - Pnt[i + 1].X;
int dy = Pnt[i].Y - Pnt[i + 1].Y;
int r = (int)Math.Sqrt(dx * dx + dy * dy);
g.DrawEllipse(Pens.Black, Pnt[i].X - r, Pnt[i].Y - r, 2 * r, 2 * r);
}
}```
Posted
Updated 18-Sep-19 8:25am
v2
Patrice T 18-Sep-19 20:55pm
And you have a question ?

## Solution 1

We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

And the first thing you should do is read the question again, carefully. The code you have is ... um ... very poor: even the one method you do show is not OOPs.

Instead, create a a Circle class which holds the center and Radius, and start by find a way to get the mouse to create an instance (Hint: Look at the MouseDown and MouseUp events for your Form or Panel).
Then add code to the Paint event handler to draw them - to trigger a redraw, Invalidate the form / panel.

From there, the rest starts to fall into place pretty easily.