Positioning text within a circle

  • From: "Ian D. Nichols" <inich@xxxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>, <programmingblind@xxxxxxxxxxxxx>
  • Date: Sat, 7 Feb 2009 18:56:49 -0500

Hi Listers,

I have a circle drawn on the monitor screen.  I know its diameter and its 
centre point in screen pixels.

I want to make sure that text I draw on the screen is completely within this 
circle.  I use the TextOut function, which uses a POINT sructure for 
positioning the text.  I can use GetTextExtentPoint32 to calculate the size and 
location of the enclosing rectangle of the text.  I need to make sure that all 
four of the corners of that rectangle are going to fall within the circle.

Can some one please tell me how I can determine the location of the 
circumference of the circle, so that I can check that my text rectangle will 
fall completely within it?  I'm more than 50 years out of high school, and 
didn't study mathematics or geometry, or whatever it is that I need, at 
university.

Thanks in advance.

Ian

Ian D. Nichols,
Toronto, Canada

Other related posts: