How to make flicker free dialog interface?
-
subj. I try: void CTest::OnPaint() { CPaintDC dc(this); CMemDC memdc(&dc); CRect clip; memdc.GetClipBox(&clip); memdc.FillSolidRect(clip, GetSysColor (COLOR_3DLIGHT)); DefWindowProc(WM_PAINT, (WPARAM)memdc->m_hDC, (LPARAM)0); } BOOL CTestDlg::OnEraseBkgnd(CDC* pDC) { return FALSE; } but anyway my *picture control* flickering and after max/min window's size flicks too. Even more when I open any file by CFileDialog my controls aren't repainted. What's wrong?
-
subj. I try: void CTest::OnPaint() { CPaintDC dc(this); CMemDC memdc(&dc); CRect clip; memdc.GetClipBox(&clip); memdc.FillSolidRect(clip, GetSysColor (COLOR_3DLIGHT)); DefWindowProc(WM_PAINT, (WPARAM)memdc->m_hDC, (LPARAM)0); } BOOL CTestDlg::OnEraseBkgnd(CDC* pDC) { return FALSE; } but anyway my *picture control* flickering and after max/min window's size flicks too. Even more when I open any file by CFileDialog my controls aren't repainted. What's wrong?
For a start, handle WM_ERASEBKGND, not WM_PAINT. --Mike-- http://home.inreach.com/mdunn/ We've secretly replaced the msdn.microsoft.com servers with Atari 800XLs. Let's see if anyone notices....
-
For a start, handle WM_ERASEBKGND, not WM_PAINT. --Mike-- http://home.inreach.com/mdunn/ We've secretly replaced the msdn.microsoft.com servers with Atari 800XLs. Let's see if anyone notices....
-
Yes. Since you are painting a custom background color, do it in WM_ERASEBKGND. --Mike-- http://home.inreach.com/mdunn/ We've secretly replaced the msdn.microsoft.com servers with Atari 800XLs. Let's see if anyone notices....
-
subj. I try: void CTest::OnPaint() { CPaintDC dc(this); CMemDC memdc(&dc); CRect clip; memdc.GetClipBox(&clip); memdc.FillSolidRect(clip, GetSysColor (COLOR_3DLIGHT)); DefWindowProc(WM_PAINT, (WPARAM)memdc->m_hDC, (LPARAM)0); } BOOL CTestDlg::OnEraseBkgnd(CDC* pDC) { return FALSE; } but anyway my *picture control* flickering and after max/min window's size flicks too. Even more when I open any file by CFileDialog my controls aren't repainted. What's wrong?
Micahel is absolutely right, but I'll also point out that when you call CPaintDC the screen is blanked, so if you ever have to draw anything in OnPaint and have trouble with flicker, don't create your PaintDC until you're about to copy the memDC over the top of it. Otherwise you may stop tearing, but you won't do a thing about flicker. Christian #include "std_disclaimer.h" People who love sausage and respect the law should never watch either one being made. The things that come to those who wait are usually the things left by those who got there first.
-
Yes. Since you are painting a custom background color, do it in WM_ERASEBKGND. --Mike-- http://home.inreach.com/mdunn/ We've secretly replaced the msdn.microsoft.com servers with Atari 800XLs. Let's see if anyone notices....
>We've secretly replaced the msdn.microsoft.com servers with Atari 800XLs. Let's see >if anyone notices.... I thought MSDN online seemed a bit quicker than normal!
-
subj. I try: void CTest::OnPaint() { CPaintDC dc(this); CMemDC memdc(&dc); CRect clip; memdc.GetClipBox(&clip); memdc.FillSolidRect(clip, GetSysColor (COLOR_3DLIGHT)); DefWindowProc(WM_PAINT, (WPARAM)memdc->m_hDC, (LPARAM)0); } BOOL CTestDlg::OnEraseBkgnd(CDC* pDC) { return FALSE; } but anyway my *picture control* flickering and after max/min window's size flicks too. Even more when I open any file by CFileDialog my controls aren't repainted. What's wrong?
I don't understand this piece of code... Where do you get CMemDC from? I don't have it? :( Also, why are you not calling BitBlt to eliminate flickering? Thx, /Tommy