I am doing a small drawing tool with MFC.
Firstly, I create a dialog to select one shape from four shapes(rectangle, line, circle, ellipse), and draw it.
Second, I create a modeless dialog to display the coordinates of the shape(startpoint.x, startpoint.y, width, height).
Coordinate dialog as below:

Finally, I create a dialog to choose other parameters. When clicking OK button, coordinates of the shape will pass to void CPropertyDlg::OnBnClickedOk(). But I found all the coordinates are zero, is that because the dialog and coordinates are instant? Once closing the dialog, the coordinates are set zero automatically?
Code to get coordinates in DrawToolView.cpp as below:
void CDrawToolView::OnLButtonUp(UINT nFlags, CPoint point)
{
m_startRect=FALSE;
::ClipCursor(NULL);
CClientDC dc(this);
dc.SelectStockObject(NULL_BRUSH);
dc.Rectangle(CRect(m_startPoint,m_OldPoint)); // draw rectangle
dc.Rectangle(CRect(m_startPoint,point));
}
Code to pass coordinates to void CPropertyDlg::OnBnClickedOk() as below:
void CPropertyDlg::OnBnClickedOk()
{
UpdateData();
CDrawToolView coordinate;
origin_x = coordinate.m_startPoint.x;
origin_y = coordinate.m_startPoint.y;
width = coordinate.m_OldPoint.x-coordinate.m_startPoint.x;
height = coordinate.m_OldPoint.y-coordinate.m_startPoint.y;;
OnOK();
}
Could some one help me ?