I am new to MFC and I am trying to change the size of my objects with respect to form. For this, I am using single document project and in View.cpp and MainFrm.cpp I have changed form size.
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.cx = 400;
cs.cy = 400;
return TRUE;
}
and in View.cpp, I have fixed the initial size of screen as given below.
BOOL CDCDrawingView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.cx = 400;
//const wchar_t a = cs.cx;
width = cs.cx;
cs.cy = 400;
height = cs.cy;
return CView::PreCreateWindow(cs);
}
Here comes the problem, I want to draw the objects and I want to change the size of those objects with respect to size of form by using mouse. The form is able to change its size but I dont know how to update the form coordinates. I have attached the initial form and and form after changing size by mouse. initial form is given below. enter image description here and form after changing size by mouse is given below. enter image description here could someone please tell me how to change the objects with resizing form? Thanks in advance.