Click here to Skip to main content
16,019,873 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Repainting of dialog box takes time. Pin
R@jeev K R8-Mar-10 20:55
R@jeev K R8-Mar-10 20:55 
GeneralRe: Repainting of dialog box takes time. Pin
Le@rner8-Mar-10 20:59
Le@rner8-Mar-10 20:59 
GeneralRe: Repainting of dialog box takes time. Pin
R@jeev K R8-Mar-10 21:18
R@jeev K R8-Mar-10 21:18 
GeneralRe: Repainting of dialog box takes time. Pin
Le@rner8-Mar-10 22:08
Le@rner8-Mar-10 22:08 
GeneralRe: Repainting of dialog box takes time. Pin
R@jeev K R8-Mar-10 22:20
R@jeev K R8-Mar-10 22:20 
GeneralRe: Repainting of dialog box takes time. Pin
Le@rner9-Mar-10 0:22
Le@rner9-Mar-10 0:22 
GeneralRe: Repainting of dialog box takes time. Pin
R@jeev K R9-Mar-10 0:44
R@jeev K R9-Mar-10 0:44 
GeneralRe: Repainting of dialog box takes time. [modified] Pin
Mohan Ramachandra9-Mar-10 1:54
Mohan Ramachandra9-Mar-10 1:54 
Le@rner wrote:
BOOL CTest::OnEraseBkgnd(CDC *pDC)
{
CPen myPen,hpenOld;
CRect rect;
GetClientRect(&rect);
for(int i=0;i<rect.bottom;)
{="" mypen.createpen(ps_solid,1,rgb(241,244,250));
="" pdc-="">SelectObject(&myPen);
pDC->MoveTo(0,i);
pDC->LineTo(rect.right,i);
i++;
myPen.DeleteObject();
}
return 1
}

Actually you are filling dialog with RGB(241,244,250) color.

Change the OnEraseBkgnd
BOOL CTest::OnEraseBkgnd(CDC *pDC)
{
	CRect rect;
	GetClientRect(&rect);	
	pDC->FillSolidRect(rect,RGB(241,244,250));	
	return TRUE;
}


to avoid for loop, unnecessary creation and destroying of pen,and filling dialog background color using LineTo and MoveTo functions.

This one can make you drawing bit faster.
modified on Tuesday, March 9, 2010 8:00 AM

GeneralRe: Repainting of dialog box takes time. Pin
Le@rner9-Mar-10 2:00
Le@rner9-Mar-10 2:00 
GeneralRe: Repainting of dialog box takes time. Pin
Eugen Podsypalnikov9-Mar-10 0:40
Eugen Podsypalnikov9-Mar-10 0:40 
GeneralRe: Repainting of dialog box takes time. Pin
Le@rner9-Mar-10 0:42
Le@rner9-Mar-10 0:42 
GeneralRe: Repainting of dialog box takes time. Pin
Eugen Podsypalnikov9-Mar-10 0:56
Eugen Podsypalnikov9-Mar-10 0:56 
GeneralRe: Repainting of dialog box takes time. Pin
Le@rner9-Mar-10 1:01
Le@rner9-Mar-10 1:01 
GeneralRe: Repainting of dialog box takes time. Pin
Eugen Podsypalnikov9-Mar-10 1:05
Eugen Podsypalnikov9-Mar-10 1:05 
GeneralRe: Repainting of dialog box takes time. Pin
Le@rner9-Mar-10 1:41
Le@rner9-Mar-10 1:41 
QuestionHow to allocate memory for 2-D integer array in one line? Pin
Nilesh Hamane8-Mar-10 18:35
Nilesh Hamane8-Mar-10 18:35 
AnswerRe: How to allocate memory for 2-D integer array in one line? Pin
Avi Berger8-Mar-10 19:23
Avi Berger8-Mar-10 19:23 
GeneralRe: How to allocate memory for 2-D integer array in one line? Pin
Cool_Dev8-Mar-10 19:59
Cool_Dev8-Mar-10 19:59 
QuestionRe: How to allocate memory for 2-D integer array in one line? Pin
CPallini8-Mar-10 20:50
mveCPallini8-Mar-10 20:50 
AnswerRe: How to allocate memory for 2-D integer array in one line? Pin
Eugen Podsypalnikov8-Mar-10 20:54
Eugen Podsypalnikov8-Mar-10 20:54 
AnswerRe: How to allocate memory for 2-D integer array in one line? Pin
LunaticFringe9-Mar-10 3:18
LunaticFringe9-Mar-10 3:18 
GeneralRe: How to allocate memory for 2-D integer array in one line? Pin
Nilesh Hamane26-Jan-11 22:34
Nilesh Hamane26-Jan-11 22:34 
Questionrandom numbers Pin
MsmVc8-Mar-10 18:22
MsmVc8-Mar-10 18:22 
AnswerRe: random numbers Pin
Rajesh R Subramanian8-Mar-10 18:31
professionalRajesh R Subramanian8-Mar-10 18:31 
GeneralRe: random numbers Pin
MsmVc8-Mar-10 18:49
MsmVc8-Mar-10 18:49 

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.