Do you know how to calculate the center of a rectangle?

using simple maths and by knowing the coordinates of a rectangle, you can. 🙂

Before those calculation, just try the MFC method of CRect class. 


which returns a CPoint object that is the centerpoint of CRect.

for example

CRect rect;
CPoint cPoint;
cPoint = rect.CenterPoint();

//cPoint.x will returns the Center x coordinate and cPoint.y returns the Center y coordinate

Keep doing your part and leave the rest to God.