[code]void CSHAPE_EXView::OnDraw(CDC* pDC) // pDC를 직접 이용한다.;
{
CSHAPE_EXDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CBrush myBrush(RGB(0,0,255));
CBrush* pOldBrush;
pOldBrush = pDC->SelectObject(&myBrush);
pDC->Rectangle(m_Rect);
pDC->SelectObject(pOldBrush);
}
void CSHAPE_EXView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_Rect = CRect(point.x-100, point.y-100, point.x+100, point.y+100);
Invalidate(); // 강제로 WM_PAINT발생
CView::OnLButtonDown(nFlags, point);
}
[/code]
{
CSHAPE_EXDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CBrush myBrush(RGB(0,0,255));
CBrush* pOldBrush;
pOldBrush = pDC->SelectObject(&myBrush);
pDC->Rectangle(m_Rect);
pDC->SelectObject(pOldBrush);
}
void CSHAPE_EXView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_Rect = CRect(point.x-100, point.y-100, point.x+100, point.y+100);
Invalidate(); // 강제로 WM_PAINT발생
CView::OnLButtonDown(nFlags, point);
}
[/code]
'Windows > MFC' 카테고리의 다른 글
시스템 폰트 얻기 system font (0) | 2013.10.02 |
---|---|
TEXTMETRIC (0) | 2013.10.02 |
타원 그리기 Ellipse (0) | 2013.10.02 |
가상키코드 VirtualKey code (0) | 2013.10.02 |
NC cilent area (0) | 2013.10.02 |