| | |
bitmap dissapears on window resize
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Jan 2008
Posts: 119
Reputation:
Solved Threads: 10
I have a document/view aplication that opens a bitmap
I use the following OnDraw override to draw the bitmap on a window and OnOpenDocument to opening the image from file
The bitmap handle ( HBITMAP bmaphandle ) is taken from the Document object that does LoadImage in it's OnOpenDocument method
HBITMAP bmaphandle = pDoc->GetHandleToBitmap();
The problem I have is that on resizeing the window or when i move another window over it the image dissapears from the view. How do I make it persistent?
thx
I use the following OnDraw override to draw the bitmap on a window and OnOpenDocument to opening the image from file
The bitmap handle ( HBITMAP bmaphandle ) is taken from the Document object that does LoadImage in it's OnOpenDocument method
HBITMAP bmaphandle = pDoc->GetHandleToBitmap();
The problem I have is that on resizeing the window or when i move another window over it the image dissapears from the view. How do I make it persistent?
thx
C++ Syntax (Toggle Plain Text)
BOOL CImageFilterDoc::OnOpenDocument( LPCTSTR strFilename ) { if ( ( m_hBitmap = (HBITMAP)LoadImage(NULL, strFilename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE) ) == NULL ) return FALSE; return TRUE; } void CImageFilterView::OnDraw(CDC* pDC) { CImageFilterDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc) return; // TODO: add draw code for native data here HBITMAP bmaphandle = pDoc->GetHandleToBitmap(); if ( bmaphandle ) { CClientDC dc(this); CDC *mdc=new CDC; mdc->CreateCompatibleDC(&dc); CBitmap bitmap; bitmap.m_hObject = bmaphandle; mdc->SelectObject(bitmap); CRect rect; GetClientRect(&rect); dc.BitBlt(0,0,rect.right,rect.bottom,mdc,0,0,SRCCOPY); delete mdc; } }
![]() |
Other Threads in the C++ Forum
- Previous Thread: Question regarding base class and derived class
- Next Thread: Confusions related to Dll.
Views: 648 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C++
6 add api array arrays beginner binary c++ c/c++ calculator char class classes code compile compiler console conversion convert count data delete desktop directshow dll download dynamic encryption error file forms fstream function functions game givemetehcodez google graph gui iamthwee ifstream input int integer java lib library linkedlist linker linux loop looping loops map math matrix memory microsoft newbie news number output parameter pointer problem program programming project python random read recursion recursive reference return sort stream string strings struct studio system template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






