Category Archives: MFC

[MFC] Dialog에서 View 접근하기

#include "ProfileView.h"
#include "MainFrm.h"
#include "ProfileDoc.h"
void PsnDlg::OnClickedButtonView()
{
        // 이런식으로 Frame에서 View를 꺼내온다음
	CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
	CProfileView* pView = (CProfileView*)pFrame->GetActiveView();


        //포인터로 접근하면 된다.
	pView->Invalidate();

}

[MFC] Multiline Draw

void CProfileView::OnDraw(CDC* pDC)
{
CProfileDoc* pDoc = GetDocument();
CRect rect;
CString result;

this->GetClientRect(&rect);

result.Format(_T("이름 : %s \n나이 : %s \n운전면허 : %s \n직업 : %s \n주거 : %s \n "), s_name, s_age, s_license, s_job, s_live);
pDC->DrawText(result, rect, DT_LEFT | DT_WORDBREAK | DT_EDITCONTROL);
}