Search

'SetRedraw'에 해당되는 글 2건

  1. 2016.10.26 MFCGridCtrl OnEraseBkgnd ScrollBar
  2. 2016.10.24 MFCGridCtrl CGridCtrl ScrollBar Visible

MFCGridCtrl OnEraseBkgnd ScrollBar

Programming/MFCGridCtrl 2016. 10. 26. 11:34 Posted by TanSanC
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

MFCGridCtrl OnEraseBkgnd ScrollBar Redraw








MFC Dialog Color 를 바꾸기 위해


OnEraseBkgnd 을 오버라이딩하여 사용하면


Dialog 를 새로 그리게 되는데


이때 CGridCtrl 의 스크롤바 영역도 같이 새로 그리게 된다.








그래서 스크롤바가 존재하지만 안보이는 경우가 발생한다.


그럴때는 OnEraseBkgnd 에서 Dialog 를 새로그린 다음



m_Grid.SetRedraw(true, true);






Redraw 를 하면


스크롤 바를 새로 그린다.








336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

MFCGridCtrl CGridCtrl ScrollBar Visible






If you change Dialog color used by OnEraseBkgnd();



you can't see CGridCtrl's ScrollBar











in that case, you should add m_Grid.SetRedraw(true, true); to OnEraseBkgnd();











BOOL CMyDialog::OnEraseBkgnd(CDC* pDC)
{
	// TODO: 여기에 메시지 처리기 코드를 추가 및/또는 기본값을 호출합니다.

	CRect rect;

	GetClientRect(&rect);

	CBrush myBrush(RGB(255, 255, 255));    // dialog background color <- 요기 바꾸면 됨.
	
	CBrush *pOld = pDC->SelectObject(&myBrush);

	BOOL bRes = pDC->PatBlt(0, 0, rect.Width(), rect.Height(), PATCOPY);

	pDC->SelectObject(pOld);    // restore old brush

	m_Grid.SetRedraw(true, true);

	return bRes;                       // 	return CDialog::OnEraseBkgnd(pDC);
}