Assistance required on Bitmaps
-
I have an application that allows the user to bookmark different locations in a video. It saves the video images at the bookmarks. There is a listbox that shows all the bookmarks. Double-click on the listbox will bring the video to the selected bookmark position. But I'm unable to bring out the save image and display onto a picture control. I tried using CBitmap and CStatic but still unable to get the images out. I have already recode this portion dozens of times. main problem: Getting the picture to be display. (I'm able to get the full path to the selected picture) Can someone offer me advice on how to solve this? Thanks
-
I have an application that allows the user to bookmark different locations in a video. It saves the video images at the bookmarks. There is a listbox that shows all the bookmarks. Double-click on the listbox will bring the video to the selected bookmark position. But I'm unable to bring out the save image and display onto a picture control. I tried using CBitmap and CStatic but still unable to get the images out. I have already recode this portion dozens of times. main problem: Getting the picture to be display. (I'm able to get the full path to the selected picture) Can someone offer me advice on how to solve this? Thanks
What format are the saved images in? If they are BMP,JPEG,GIF you can use the OLE picture support to render them, and you could derive from CStatic to make your own picture box, or use something like the one from MSDN done by Paul DiLascia (spelling?) Steve S Developer for hire!
-
What format are the saved images in? If they are BMP,JPEG,GIF you can use the OLE picture support to render them, and you could derive from CStatic to make your own picture box, or use something like the one from MSDN done by Paul DiLascia (spelling?) Steve S Developer for hire!
-
I have an application that allows the user to bookmark different locations in a video. It saves the video images at the bookmarks. There is a listbox that shows all the bookmarks. Double-click on the listbox will bring the video to the selected bookmark position. But I'm unable to bring out the save image and display onto a picture control. I tried using CBitmap and CStatic but still unable to get the images out. I have already recode this portion dozens of times. main problem: Getting the picture to be display. (I'm able to get the full path to the selected picture) Can someone offer me advice on how to solve this? Thanks
Hi, If m_stillPic is a StaticCtrl & your BMP path is "C:\\Pic.bmp" :
HBITMAP hBitmap = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(), _T("C:\\Pic.bmp"), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION); if (hBitmap) m_stillPic.SetBitmap(hBitmap); m_stillPic.UpdateWindow();
-
I have an application that allows the user to bookmark different locations in a video. It saves the video images at the bookmarks. There is a listbox that shows all the bookmarks. Double-click on the listbox will bring the video to the selected bookmark position. But I'm unable to bring out the save image and display onto a picture control. I tried using CBitmap and CStatic but still unable to get the images out. I have already recode this portion dozens of times. main problem: Getting the picture to be display. (I'm able to get the full path to the selected picture) Can someone offer me advice on how to solve this? Thanks
Hi, create a CStatic control and choose type 'rectangle'. Use the following code to draw into that window.
void DrawBitmap(CBitmap* pBitmap, CWnd* pWindow, CPoint Offset)
{
// get bitmap information
BITMAP bmpInfo;
pBitmap->GetObject(sizeof(bmpInfo), &bmpInfo);// get source size CSize srcSize; srcSize.cx = bmpInfo.bmWidth; srcSize.cy = bmpInfo.bmHeight; // get window's client device context CClientDC\* pDC = new CClientDC(pWindow); // create compatible divice context for stretching CDC\* memDC = new CDC; memDC->CreateCompatibleDC(pDC); // load bitmap in original size CBitmap\* old = memDC->SelectObject(pBitmap); // copy bitmap data pDC->BitBlt(Offset.x, Offset.y, srcSize.cx, srcSize.cy, memDC, 0, 0, SRCCOPY); // reselect first bitmap memDC->SelectObject(old); // delete device context and reset pointer delete memDC; memDC = 0; // delete device context and reset pointer delete pDC; pDC = 0;
}
Regards If I have seen further, it is by standing on the shoulders of giants. Isaac Newton