| | |
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.
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator getline graph homeworkhelper iamthwee ifstream image input int java lib list loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings template text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






