Search

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);
}


MFC CGridCtrl Color Change

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

MFC CGridCtrl Color Change




 





COLORREF ItemBkColour = RGB(255,255,255);

m_Grid.SetItemBkColour(0, 0, ItemBkColour);

m_Grid.SetItemBkColour(0, 1, ItemBkColour);

m_Grid.SetItemBkColour(0, 2, ItemBkColour);

m_Grid.SetItemBkColour(0, 3, ItemBkColour);






m_Grid.SetBkColor(RGB(255, 0, 0)); 






MFC CWnd Control Border Color Change

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

MFC CWnd Control Border Color Change









CWnd::OnNcPaint

 

게시: 2016년 4월

The framework calls this member function when the nonclient area needs to be painted.

비클라이언트 영역을 그려야 할 때 프레임 워크는이 멤버 함수를 호출 합니다.

afx_msg void OnNcPaint( );

The default implementation paints the window frame.


An application can override this call and paint its own custom window frame. The clipping region is always rectangular, even if the shape of the frame is altered.


기본 구현에서는 창 프레임을 그립니다.


응용 프로그램이이 호출을 무시 하 고 자체 사용자 지정 창 프레임을 페인트할 수 있습니다. 클리핑 영역은 프레임의 모양을 변경 하는 경우에 항상 사각형입니다.



void CDerivedEdit::OnNcPaint() 
{
		CDC* pDC = GetWindowDC( );
		
		//work out the coordinates of the window rectangle,
		CRect rect;
		GetWindowRect( &rect);
		rect.OffsetRect( -rect.left, -rect.top);
		
		//Draw a single line around the outside
		CBrush brush( RGB( 255, 0, 0));
		pDC->FrameRect( &rect, &brush);
		ReleaseDC( pDC);
}


'Programming > MFC' 카테고리의 다른 글

CEdit control의 font 바꾸기  (0) 2016.10.25
CTextProgressCtrl hide Edge  (0) 2016.10.25
MFC CheckBox 컨트롤의 현재 상태  (0) 2016.10.19
MFC Control Color Change  (0) 2016.10.19
MFC Bitmap Button  (0) 2016.10.18