view 클래스에서 WM_ERASEBKGND 메시지 핸들러를 추가하여 다음과 같이 코드를 입력한다.

BOOL CImageShopView::OnEraseBkgnd(CDC* pDC)
{
	CBrush br;
	br.CreateHatchBrush(HS_DIAGCROSS, RGB(200, 200, 200));
	FillOutsideRect(pDC, &br);

	return TRUE; // Erased
}


한가지 주의할 것은, 함수 반환값을 항상 TRUE로 지정해주어야 한다.

참고로, FillOutsideRect 함수에 대한 설명은 다음과 같다.

Call FillOutsideRect to fill the area of the view that appears outside of the scrolling area. Use FillOutsideRect in your scroll view’s OnEraseBkgnd handler function to prevent excessive background repainting.




Posted by kkokkal
: