Click here to Skip to main content
16,007,885 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
Paul M Watt28-Feb-02 14:23
mentorPaul M Watt28-Feb-02 14:23 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
alex.barylski28-Feb-02 16:26
alex.barylski28-Feb-02 16:26 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
Paul M Watt28-Feb-02 19:52
mentorPaul M Watt28-Feb-02 19:52 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
Paul M Watt28-Feb-02 10:53
mentorPaul M Watt28-Feb-02 10:53 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
alex.barylski28-Feb-02 12:29
alex.barylski28-Feb-02 12:29 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
Paul M Watt28-Feb-02 14:26
mentorPaul M Watt28-Feb-02 14:26 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
alex.barylski28-Feb-02 16:35
alex.barylski28-Feb-02 16:35 
GeneralRe: OnEraseBkgnd VS OnPaint Pin
alex.barylski28-Feb-02 17:17
alex.barylski28-Feb-02 17:17 
Actually Kilo...i'm really curious, so here's my exact code...I dunno why it flickers in OnErase and Not OnDraw.

BOOL CRulerView::OnEraseBkgnd(CDC* pDC)
{ 
	CMemDC buff(pDC);

	//Drawing area
	CRect rect;	
	GetClientRect(&rect);

	//Draw ruler background
	buff.FillSolidRect(0, 0, m_rulerSize, rect.bottom, ::GetSysColor(COLOR_BTNFACE));
	buff.FillSolidRect(0, 0, rect.right, m_rulerSize, ::GetSysColor(COLOR_BTNFACE));
	
	//window borders width
	UINT nBorderWidth = ::GetSystemMetrics(SM_CXEDGE);

	//Draw 3D border, blends with parent window
	if(m_b3Dborder){
		buff.DrawEdge(CRect(0, 0, rect.right, m_rulerSize), EDGE_RAISED, BF_RIGHT | BF_TOP);
		buff.DrawEdge(CRect(0, 0, m_rulerSize, rect.bottom), EDGE_RAISED , BF_LEFT | BF_BOTTOM);
	}

	//Draw border edge
	buff.DrawEdge(CRect(m_rulerSize-nBorderWidth, m_rulerSize-nBorderWidth, rect.right, rect.bottom), EDGE_SUNKEN, BF_TOP | BF_LEFT);

	//Draw the rulers
	OnDrawRuler(&buff, CRect(nBorderWidth*2, m_rulerSize-nBorderWidth, m_rulerSize-(nBorderWidth*2), rect.bottom-m_nScrSize+nBorderWidth),  RT_VERT);
	OnDrawRuler(&buff, CRect(m_rulerSize-nBorderWidth, nBorderWidth*2, rect.right-m_nScrSize+nBorderWidth, m_rulerSize-(nBorderWidth*2)), RT_HORZ);

	//Draw the cursor tracker out of bounds
	OnMouseMove(NULL, CPoint(-10,-10));	
	
	return FALSE; 
}

void CRulerView::OnDraw(CDC* pDC)
{
}


Swap the code from OnErase into OnDraw and you'll see NO flicker...whats going on...?

I even tried writting to a memDC and blitting it myself to the screen (instead of using CMemDC) but no luck.

Either way would be great.

Thanx!

"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
GeneralRe: OnEraseBkgnd VS OnPaint Pin
Paul M Watt28-Feb-02 19:46
mentorPaul M Watt28-Feb-02 19:46 
GeneralSick and tired of VC++ IDE's $#!T Pin
Jason Hooper28-Feb-02 8:59
Jason Hooper28-Feb-02 8:59 
GeneralRe: Sick and tired of VC++ IDE's $#!T Pin
Carlos Antollini28-Feb-02 9:11
Carlos Antollini28-Feb-02 9:11 
GeneralFirst-chance exception error Pin
ed128-Feb-02 8:31
ed128-Feb-02 8:31 
GeneralRe: First-chance exception error Pin
Paul M Watt28-Feb-02 8:34
mentorPaul M Watt28-Feb-02 8:34 
GeneralRe: First-chance exception error Pin
Steen Krogsgaard28-Feb-02 9:44
Steen Krogsgaard28-Feb-02 9:44 
GeneralRestaurant Project Pin
28-Feb-02 8:21
suss28-Feb-02 8:21 
GeneralRe: Restaurant Project Pin
Carlos Antollini28-Feb-02 8:30
Carlos Antollini28-Feb-02 8:30 
GeneralRe: Restaurant Project Pin
Nemanja Trifunovic28-Feb-02 8:41
Nemanja Trifunovic28-Feb-02 8:41 
GeneralRe: Restaurant Project Pin
Christian Graus28-Feb-02 9:06
protectorChristian Graus28-Feb-02 9:06 
GeneralLoad gif, jpeg or tif image in VC++ Pin
28-Feb-02 7:29
suss28-Feb-02 7:29 
GeneralRe: Load gif, jpeg or tif image in VC++ Pin
Chris Losinger28-Feb-02 8:04
professionalChris Losinger28-Feb-02 8:04 
GeneralRe: Load gif, jpeg or tif image in VC++ Pin
Christian Graus28-Feb-02 9:25
protectorChristian Graus28-Feb-02 9:25 
GeneralRe: Load gif, jpeg or tif image in VC++ Pin
alex.barylski28-Feb-02 9:59
alex.barylski28-Feb-02 9:59 
GeneralRe: Load gif, jpeg or tif image in VC++ Pin
Christian Graus28-Feb-02 10:42
protectorChristian Graus28-Feb-02 10:42 
GeneralRe: Load gif, jpeg or tif image in VC++ Pin
Chris Losinger28-Feb-02 11:12
professionalChris Losinger28-Feb-02 11:12 
GeneralRe: Load gif, jpeg or tif image in VC++ Pin
Christian Graus28-Feb-02 11:21
protectorChristian Graus28-Feb-02 11:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.