fragy153
March 8th, 2005, 02:57 AM
Hello
I have a GDI performance problem. I implemented a MDI application and a black background, a grid and text that shows the current mouse position within the document window.
I used GDI functions, for example to draw the GRID i did the following
DeleteObject(hbmMem_grid );
DeleteDC(hdcMem_grid );
RECT rc;
HBRUSH hbrBkGnd;
HPEN hpen;
GetClientRect(hWnd, &rc);
hdcMem_grid = CreateCompatibleDC(hdc);
hbmMem_grid = CreateCompatibleBitmap(hdc,rc.right-rc.left,rc.bottom-rc.top);
SelectObject(hdcMem_grid , hbmMem_grid );
hbrBkGnd = CreateSolidBrush(RGB(255, 255, 255));
FillRect(hdcMem_grid , &rc, hbrBkGnd);
DeleteObject(hbrBkGnd);
hpen = CreatePen(PS_SOLID, 0, RGB(225, 233, 233));
SelectObject(hdcMem_grid , hpen);
for(int i=1; i<5; i++)
{
MoveToEx(hdcMem_grid ,rc.left+((rc.right-rc.left)/5)*i,rc.top,NULL);
LineTo(hdcMem_grid ,rc.left+((rc.right-rc.left)/5)*i,rc.bottom );
MoveToEx(hdcMem_grid ,rc.left, rc.top+((rc.bottom-rc.top)/5)*i,NULL);
LineTo(hdcMem_grid , rc.right, rc.top+((rc.bottom-rc.top)/5)*i );
}
DeleteObject(hpen);
Everything is correctly drawn to the document area but the problem arises when I move the mouse over the document area. It is extremely slow! The mouse pointer
reacts really slow...
Have you got any ideas of what might be the problem?
I tried the same application in other machines ( more powerful ) and everything was ok. But my machine isn't that slow I have a 1.6Ghz pentium 4 with Nvidia 64Mb graphics card...And the application is quite simple...
Thanks
I have a GDI performance problem. I implemented a MDI application and a black background, a grid and text that shows the current mouse position within the document window.
I used GDI functions, for example to draw the GRID i did the following
DeleteObject(hbmMem_grid );
DeleteDC(hdcMem_grid );
RECT rc;
HBRUSH hbrBkGnd;
HPEN hpen;
GetClientRect(hWnd, &rc);
hdcMem_grid = CreateCompatibleDC(hdc);
hbmMem_grid = CreateCompatibleBitmap(hdc,rc.right-rc.left,rc.bottom-rc.top);
SelectObject(hdcMem_grid , hbmMem_grid );
hbrBkGnd = CreateSolidBrush(RGB(255, 255, 255));
FillRect(hdcMem_grid , &rc, hbrBkGnd);
DeleteObject(hbrBkGnd);
hpen = CreatePen(PS_SOLID, 0, RGB(225, 233, 233));
SelectObject(hdcMem_grid , hpen);
for(int i=1; i<5; i++)
{
MoveToEx(hdcMem_grid ,rc.left+((rc.right-rc.left)/5)*i,rc.top,NULL);
LineTo(hdcMem_grid ,rc.left+((rc.right-rc.left)/5)*i,rc.bottom );
MoveToEx(hdcMem_grid ,rc.left, rc.top+((rc.bottom-rc.top)/5)*i,NULL);
LineTo(hdcMem_grid , rc.right, rc.top+((rc.bottom-rc.top)/5)*i );
}
DeleteObject(hpen);
Everything is correctly drawn to the document area but the problem arises when I move the mouse over the document area. It is extremely slow! The mouse pointer
reacts really slow...
Have you got any ideas of what might be the problem?
I tried the same application in other machines ( more powerful ) and everything was ok. But my machine isn't that slow I have a 1.6Ghz pentium 4 with Nvidia 64Mb graphics card...And the application is quite simple...
Thanks