190717 - 4
사각 정보 이동 다이얼로그 만들기
이벤트 처리기를 Doc에 생성
프레임은 어디서든지 메인프레임을 얻을 수 있다.
#include "MainFrm.h"
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
void CCBDoc::OnRectmove()
{
    CMoveDlg dlg;
    if (IDOK == dlg.DoModal()) {
        // TODO: 정보 변경 하는 코드 추가
        POSITION pos = m_rtList.GetHeadPosition();
        while (pos) {
            CRect& rt = m_rtList.GetNext(pos);
            rt.OffsetRect(dlg.m_nX, dlg.m_nY);
        }
//방법1
        pos = this->GetFirstViewPosition();
        this->GetNextView(pos)->Invalidate();
//방법2
        //view를 list로 가져오는 멤버변수 사용
        ((CView*)m_viewList.GetHead())->Invalidate();
    }
}
-배열 <-> 리스트 변환가능
frame
    m_wndStatusBar.SetPaneInfo(1, ID_SEPARATOR, SBS_NORMAL, 250); // 준비 다음 칸에 하나를더 추가함
    m_wndStatusBar.SetPaneText(1, _T("test status"));
static UINT indicators[] =
{
    ID_SEPARATOR, // 상태 줄 표시기
    ID_SEPARATOR,// 선택출력용
    ID_SEPARATOR,// 좌표출력용
    ID_INDICATOR_CAPS,
    ID_INDICATOR_NUM,
    ID_INDICATOR_SCRL,
};
void CCBView::OnMouseMove(UINT nFlags, CPoint point)
{
    CString s;
    s.Format(_T("좌표: (%d,%d)"), point.x, point.y);
    CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
    pFrame->m_wndStatusBar.SetPaneText(2, s);
    CView::OnMouseMove(nFlags, point);
}
- 마우스 이동시 상태바에 표시하는 코드
'MFC' 카테고리의 다른 글
| [MFC] 실행순서, DOC과 View 업데이트, 분할창에 사각형정보 다르게 (0) | 2019.11.10 | 
|---|---|
| Hide Show Controls Using the Button, List View, Draw Rectangle (0) | 2019.11.09 | 
| [MFC] 스크롤바 설정(제한), Using Views in Frames (0) | 2019.11.07 | 
| [MFC] Calling up mainframe, Modaless dialog (0) | 2019.11.06 | 
| [MFC] Modal Dialog, Databinding 직접해주기 (0) | 2019.11.05 |