| | |
Drawing bitmap on window - how to clear window/HDC?
![]() |
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 |
* adobe ansi api array arrays binarysearch calculate centimeter char cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax directory dynamic feet fflush file floatingpointvalidation fork forloop frequency getlasterror getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling gtkwinlinux hacking hardware highest homework i/o inches incrementoperators intmain() iso km linked linkedlist linux linuxsegmentationfault list locate logical_drives loopinsideloop. match matrix microsoft motherboard mqqueue mysql oddnumber odf open opendocumentformat openwebfoundation pattern pdf performance pointer posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition reversing scanf scheduling segmentationfault send shape single socketprograming socketprogramming stack standard strchr string suggestions test unix urboc user variable voidmain() whythiscodecausesegmentationfault win32api windows.h






