Click here to Skip to main content
15,903,385 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralATL : Subclassing ComboBox Pin
Martijn3-Dec-02 0:47
Martijn3-Dec-02 0:47 
GeneralMemory Clean Pin
suresh_sathya3-Dec-02 0:19
suresh_sathya3-Dec-02 0:19 
GeneralRe: Memory Clean Pin
Christian Graus3-Dec-02 0:22
protectorChristian Graus3-Dec-02 0:22 
GeneralRe: Memory Clean Pin
dabs3-Dec-02 3:00
dabs3-Dec-02 3:00 
GeneralRe: Memory Clean Pin
Michael P Butler3-Dec-02 3:37
Michael P Butler3-Dec-02 3:37 
QuestionFlicker free List Ctrl ? Pin
Christoffer A. Andersen2-Dec-02 23:15
Christoffer A. Andersen2-Dec-02 23:15 
AnswerRe: Flicker free List Ctrl ? Pin
Christoffer A. Andersen3-Dec-02 0:00
Christoffer A. Andersen3-Dec-02 0:00 
GeneralRe: Flicker free List Ctrl ? Pin
KaЯl3-Dec-02 2:35
KaЯl3-Dec-02 2:35 
Beware that InvalidateRect() just marks the rectangle as to be redrawn, but doesn't generate the repaintin.

From MSDN: "If you do not want the application to wait until the application's message queue has no other messages, use the UpdateWindow function to force the WM_PAINT message to be sent immediately"

So if your application processes other messages, your element could be not redrawn.
Even with ListCtrl, double buffering is useful to avoid flickering, when resizing the list for example.
A way to do so is, keeping the actual code you have to draw your elements:

void CListCtrlEx::OnPaint() <br />
{<br />
	CPaintDC dc(this); // device context for painting<br />
	CRect cClipRect;<br />
<br />
	if(dc.GetClipBox(&cClipRect) == NULLREGION)<br />
		return;<br />
<br />
	int top = 0;<br />
	CRect cRectBounds, cRectHeader, cRectClient;<br />
<br />
	// Need to update header manually<br />
	CHeaderCtrl* pHeader = (CHeaderCtrl*)GetDlgItem(0);<br />
	pHeader->GetClientRect(&cRectHeader);		<br />
	CRect cInterRect;<br />
<br />
	cInterRect.IntersectRect(cRectHeader, cClipRect);<br />
	top = cRectHeader.bottom;<br />
<br />
	cClipRect.top = max(cClipRect.top, top);<br />
	CMemoryDC pDC(&dc, cClipRect, top);<br />
	pDC->FillSolidRect(cClipRect, ::GetSysColor(COLOR_WINDOW));<br />
<br />
	DefWindowProc(WM_PAINT, (WPARAM) pDC->GetSafeHdc(), 0);<br />
}


// CMemoryDC is my implementation derived from this article[^]

HTH,





Ohé Partisans, Ouvriers et Paysans
C'est l'alarme!

Le Chant des Partisans

GeneralA problem related with DrawDibDraw Pin
springofcn2-Dec-02 22:23
springofcn2-Dec-02 22:23 
GeneralHelp On using CFontDialog in a Property sheets Pin
AnilG2-Dec-02 22:22
AnilG2-Dec-02 22:22 
GeneralActiveX Document Server Pin
Goa2-Dec-02 22:08
Goa2-Dec-02 22:08 
GeneralDialolgProc doesnt work Pin
Tili2-Dec-02 21:36
Tili2-Dec-02 21:36 
GeneralRe: DialolgProc doesnt work Pin
Rickard Andersson202-Dec-02 23:14
Rickard Andersson202-Dec-02 23:14 
GeneralRe: DialolgProc doesnt work Pin
Paul M Watt3-Dec-02 5:55
mentorPaul M Watt3-Dec-02 5:55 
GeneralRe: DialolgProc doesnt work Pin
Tili3-Dec-02 21:54
Tili3-Dec-02 21:54 
QuestionWhy can't use CFindReplaceDialog as A Base Class? Pin
zhdleonid2-Dec-02 21:17
zhdleonid2-Dec-02 21:17 
AnswerRe: Why can't use CFindReplaceDialog as A Base Class? Pin
jhwurmbach2-Dec-02 21:35
jhwurmbach2-Dec-02 21:35 
GeneralRe: Why can't use CFindReplaceDialog as A Base Class? Pin
zhdleonid2-Dec-02 22:02
zhdleonid2-Dec-02 22:02 
GeneralRe: Why can't use CFindReplaceDialog as A Base Class? Pin
zhdleonid2-Dec-02 23:17
zhdleonid2-Dec-02 23:17 
GeneralRe: Why can't use CFindReplaceDialog as A Base Class? Pin
jhwurmbach2-Dec-02 23:43
jhwurmbach2-Dec-02 23:43 
GeneralRe: Why can't use CFindReplaceDialog as A Base Class? Pin
zhdleonid3-Dec-02 0:49
zhdleonid3-Dec-02 0:49 
GeneralRe: Why can't use CFindReplaceDialog as A Base Class? Pin
jhwurmbach3-Dec-02 1:24
jhwurmbach3-Dec-02 1:24 
GeneralRe: Why can't use CFindReplaceDialog as A Base Class? Pin
zhdleonid3-Dec-02 2:40
zhdleonid3-Dec-02 2:40 
GeneralRe: Why can't use CFindReplaceDialog as A Base Class? Pin
Christian Graus2-Dec-02 23:43
protectorChristian Graus2-Dec-02 23:43 
GeneralRe: Why can't use CFindReplaceDialog as A Base Class? Pin
zhdleonid3-Dec-02 0:52
zhdleonid3-Dec-02 0:52 

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.