메뉴 건너뛰기

창작에 관련된 질문이나 간단한 팁, 예제를 올리는 곳

void CPingpongView::OnDraw(CDC* pDC)
{
 CPingpongDoc* pDoc = GetDocument();
 ASSERT_VALID(pDoc);
 // TODO: add draw code for native data here

 // 현재 창 크기와 같은 DC를 만듬
 CRect rect;
 GetClientRect(&rect);
 int int_client_width = (rect.right) - (rect.left);
 int int_client_height = (rect.bottom) - (rect.top);

 // 메모리상의 DC를 만듬
 CDC BufferDC; // DC 선언
 BufferDC.CreateCompatibleDC(pDC); // 윈도우 DC(pDC)와 호환되도록 함

 // 메모리상의 비트맵을 만듬
 CBitmap bmpBuffer; // DC 선언
 bmpBuffer.CreateCompatibleBitmap(pDC, int_client_width, int_client_height);
 // 인도우 DC(pDC)와 호환되도록 함

 // 윈도우 호환 비트맵을 메모리DC에 집어넣음
 CBitmap *pOldBitmap = (CBitmap *)BufferDC.SelectObject(&bmpBuffer);

 // 그려야 할 것들을 그림
 Drawing(&BufferDC);

 // 메모리DC에 그린 것을 pDC에 옮겨붙임
 pDC->BitBlt(0,0, int_client_width, int_client_height,
  &BufferDC, 0, 0, SRCCOPY);

 // 메모리DC 오브젝트 복구
 BufferDC.SelectObject(pOldBitmap);

 
}

이러면 깜박일 이유가 없는거같은데 실제론 막 깜박이네요 ㅡㅡ;;;
어디에 문제가 있는건지...

조회 수 :
6602
등록일 :
2008.06.13
11:00:38 (*.50.69.16)
엮인글 :
게시글 주소 :
https://hondoom.com/zbxe/index.php?mid=study&document_srl=208946

똥똥배

2008.06.13
18:03:24
(*.239.144.2)
MFC의 DC를 다룬지가 오래되서 가물가물하군요.
제가 창작탑에 올린 온해저자 소스를 참조하시길 바랍니다.
온해저자에서도 더블 버퍼링을 쓰고 있습니다.

A.미스릴

2008.06.16
16:43:28
(*.50.69.16)

알고보니 InValidate()에 값 false를 집어넣어야했군영...

List of Articles