I have an application which at some point draws many circles on a Panel
control. Then I want to name each circle (just a letter and a number). And I want the text to be centered, to make it look nice. For now, I have something like this:
What I do, is I take the center of that circle, and do the following:
Graphics.DrawString($"s{i+1}", panel.Font, new SolidBrush(Color.White), pointOnCircle.X, pointOnCircle.Y);
(the pointOnCircle.X and Y
being the coordinates of the center). And as you can see, it looks kinda bad.
My question here would be: Is there a way to somehow calculate that X and Y for a specified font size and those small circles radius, to make it look centered?
The result from using the accepted answer or @Johnny Mopp comment: