Re: [Dev-C++] DIB, Invalidate, flicker... please help
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2005-03-09 18:19:53
|
Long time since I wrote anything using naked Win32 API. However, if the
WM_PAINT isn't for your specific control, shouldn't you call any default
WM_PAINT code?
/Per W
On Wed, 9 Mar 2005, tichy wrote:
> Hi everybody,
> I am new on this list because I'am newby to dev-cpp programming too.
> Earlier I did my C/C++ progs with CBuilderX or BCB but all over the time =
my
> favorite
> language was Pascal (with Delphi). I have a bit expierience with Win32 AP=
I,
> but when
> I start to use dev-cpp the steairs seams to grown up.
> My api uses a tab controll asociated with main window.
> There are some other controls too asociated with the main window (ie. sta=
tus
> bar)
> standing visible all the time. Other controls visibility hangs on tab ind=
ex.
> On the page called "gobos" I have listbox to choose file/directory and a
> small static window to display
> choosen image file. This is made on LBN_DBLCLK msg.
> Code to display bitmap is executed on WM_PAINT event. Here is it:
> case WM_PAINT:
> {
> if(int iPage =3D TabCtrl_GetCurSel( g_hwndTab )=3D=3D 3)
> {
>
> HDC hdc =3D BeginPaint(g_hwndBMP, &ps);//pobierz hdc celu
> if(hdc =3D=3DNULL)MessageBox(g_hwndMain,"brak kontekstu","",MB_OK);
> HDC memoryDC =3D CreateCompatibleDC( hdc );//kreuj =BCr=F3d=B3owy hd=
c
> GetClientRect(g_hwndBMP, &rcClient);
> HBITMAP bmp =3D CreateCompatibleBitmap( hdc, rcClient.right,
> rcClient.bottom );
> HBITMAP oldBmp =3D (HBITMAP)SelectObject( memoryDC, g_bmp );//przypi=
sz
> bitmap=EA do kontekstu
> BitBlt( hdc, 0, 0, rcClient.right, rcClient.bottom, memoryDC, 0, 0,
> SRCCOPY );
> SelectObject( memoryDC, oldBmp );
> DeleteDC( memoryDC );
> DeleteObject( bmp );
> EndPaint(g_hwndBMP, &ps);
> }
>
> GetClientRect(g_hwndMain, &rcClient); WHEN I OMIT
> THIS THREE PROCEDURES
> InvalidateRect(g_hwndMain, &rcClient, TRUE); THE MAIN WINDOW
> OPENS EMPTY
> UpdateWindow(g_hwndMain); AND GRAYE=
D
>
> break;
>
> g_bmp points to bitmap loaded from file on LBN_DBLCLK.
>
> My problem is that since I've added this OnPaint event as shown upper, al=
l
> tab control rectangle does not refresh at all,
> and listbox doesn't refresh itself too - initially there are only its it=
ems
> (strings) visible untill I refresh it with mouse pointer;
> and drawn image flickers.
> Controls asociated with other tab's pages refreshes randomly.
> Where are the faults?
>
> Andrzej Kry=F1ski
> http:\\tichy.fm.interia.pl (for polish readers only)
>
>
>
> ---
> avast! antywirus: Wychodzace wiadomosc czysta.
> Baza sygnatur wirusow (VPS): 0510-0, 2005-03-08
> Przetestowano na: 2005-03-09 18:33:23
> avast! - Copyright (c) 2000-2004 ALWIL Software.
> http://www.avast.com
>
>
>
>
> ----------------------------------------------------------------------
> Najlepsze MOTO w sieci! >>> http://link
|