| | |
Drawing bitmap on window - how to clear window/HDC?
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
Hi all
My program currently loads a bitmap (given a filename) and draws it to a window (win32 application).
The problem is that once a different bitmap is loaded and drawn to the window... if the new bitmap is smaller than the old bitmap, the edges of the old bitmap are still visible once the new bitmap is drawn.
I need a way to completely clear the window before drawing each new bitmap. ... How do I do this??
Here is where I paint the window...
... where cd is the CDib*. (my bitmap class)
Each time the user loads a new bitmap to display, I call cd->LoadBitmapFile(filename).
My program currently loads a bitmap (given a filename) and draws it to a window (win32 application).
The problem is that once a different bitmap is loaded and drawn to the window... if the new bitmap is smaller than the old bitmap, the edges of the old bitmap are still visible once the new bitmap is drawn.
I need a way to completely clear the window before drawing each new bitmap. ... How do I do this??
Here is where I paint the window...
•
•
•
•
C Syntax (Toggle Plain Text)
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_PAINT: { HDC hDC = GetDC(hwnd); if (cd->GetFilename() != NULL) cd ->DrawBits(hDC,0,0); ReleaseDC(hwnd, hDC); break; } //handle other messages } }
Each time the user loads a new bitmap to display, I call cd->LoadBitmapFile(filename).
![]() |
Similar Threads
- Using OpenGL in Visual C++: Part I (Game Development)
- handling window in a window, vc++ (C++)
- new window popup (HTML and CSS)
- window stops updating (painting) itself (C++)
- Open Gl Programing Error (help)... (Game Development)
- Calling function in a child window from main parent window (C#)
- File Dialog window, save dialog window (Python)
- PC Case Mods (Geeks' Lounge)
Other Threads in the C Forum
- Previous Thread: Check data type input!!
- Next Thread: code optimization
| Thread Tools | Search this Thread |
Tag cloud for C
adobe ansi api array arrays asterisks binarysearch calculate centimeter char convert copyimagefile copypdffile cprogramme creafecopyofanytypeoffileinc createcopyoffile csyntax directory dynamic fflush file fork forloop frequency getlasterror givemetehcodez graphics gtkgcurlcompiling hacking hardware highest homework i/o inches incrementoperators infiniteloop interest kernel km lazy linked linkedlist linux linuxsegmentationfault list lists locate logical_drives match matrix microsoft motherboard multi mysql number open opendocumentformat opensource owf pattern pdf performance pointer pointers posix problem probleminc program programming pyramidusingturboccodes radix read recursion recv repetition research scanf scheduling scripting segmentationfault send sequential shape socketprograming spoonfeeding stack standard string strings structures student systemcall testautomation turboc unix user variable voidmain() wab windows.h






