| rapidlord - Jul-14-2004 server time |
| I find the solution , i didnt select objects right here`s the code: BOOL CCePropertySheet::OnInitDialog() { CTabCtrl* pTab = GetTabControl(); m_imageList.Create (60,36,ILC_COLOR, 0, 4); CDC*pCtrlDC = GetDC(); CBitmap Bitmap; CBitmap *pOldBitmap; CDC TempDC; TempDC.CreateCompatibleDC(pCtrlDC); Bitmap.CreateCompatibleBitmap(pCtrlDC,60,32); pOldBitmap = TempDC.SelectObject(&Bitmap); TempDC.ExtTextOut(0,0,ETO_OPAQUE,NULL,"write or draw",NULL); TempDC.SelectObject(pOldBitmap); tmpImageList->Add(&Bitmap, RGB(0, 0, 0)); ... .. . //more init code (not important) tmpImageList->Detach(); Bitmap.DeleteObject(); ReleaseDC(pCtrlDC); } |
| Fat Cat - Jul-12-2004 server time |
| is the syntax of your CreateCompatibileDC statements correct ? should they be; bmCDC.CreateCompatibleDC(pDC); bmCDC.SelectObject(bm); instead of; bmCDC->CreateCompatibleDC(pDC); bmCDC->SelectObject(bm); then use; pDC->BitBlt(nX, nY, bmpInfo.bmWidth, bmpInfo.bmHeight,&bmCDC, 0, 0, SRCCOPY); to copy the bitmap over |
| Fat Cat - Jul-12-2004 server time |
| I don't do much with bitmaps (mostly OpenGL), but there are a few notes on loading bitmaps and moving bitmaps using CreateCompatibleDC at http://www.gametutorials.com/Tutorials/win32/Win32_Pg3.htm Might be worth a look. |
| rapidlord - Jul-12-2004 server time |
| Tnx Red Squirrel for worm welcome bm->CreateCompatibleBitmap(pdc,60,30); not: bm->CreateCompatibleDC(pdc,60,30); i am sory "Fat Cat" but i still have a problem |
| Fat Cat - Jul-12-2004 server time |
| CDC* pdc = GetDC(); bmCDC->CreateCompatibleDC(pdc); bm->CreateCompatibleDC(pdc,60,30); You have 2 "CreateCompatibleDC" commands one after another. The second one has 3 parameters passed to it (pdc, 60, 30), should it only have 1 parameter passed to it ? ------------------------------------ CDC::CreateCompatibleDC virtual BOOL CreateCompatibleDC( CDC* pDC ); Return Value: Nonzero if the function is successful; otherwise 0. Parameters: pDC A pointer to a device context. If pDC is NULL, the function creates a memory device context that is compatible with the system display. Remarks Creates a memory device context that is compatible with the device specified by pDC. A memory device context is a block of memory that represents a display surface. It can be used to prepare images in memory before copying them to the actual device surface of the compatible device. When a memory device context is created, GDI automatically selects a 1-by-1 monochrome stock bitmap for it. GDI output functions can be used with a memory device context only if a bitmap has been created and selected into that context. This function can only be used to create compatible device contexts for devices that support raster operations. See the CDC::BitBlt member function for information regarding bit-block transfers between device contexts. To determine whether a device context supports raster operations, see the RC_BITBLT raster capability in the member function CDC::GetDeviceCaps. |
| Red Squirrel - Jul-09-2004 server time |
| Welcome aboard. Sorry I can't helo you though, hav'nt done C++ in a while and never got that advanced. Got discouraged when I realize making a triangle took 1000 lines of code. |
| rapidlord - Jul-09-2004 server time |
| The problem is in inserting CBitmap in to CTabCtrl, if i load CBitmap from resource it`s ok, but if try to create CBitmap , write for example something on it, and then insert that bitmap to CTabCtrl nothing hepens. First sample is code with CBitmap from resource working OK: BOOL CCePropertySheet::OnInitDialog() { CTabCtrl* pTab = GetTabControl(); m_imageList.Create (60,36,ILC_COLOR, 0, 4); CBitmap bm; bm.LoadBitmap(IDB_TAB1); m_imageList.Add(&bm, RGB(0, 0, 0)); ... .. . //more init code (not important) } ============================================= And now the sample code where is CBitmap created dinamicly thru CDC and inserted: BOOL CCePropertySheet::OnInitDialog() { CTabCtrl* pTab = GetTabControl(); m_imageList.Create (60,36,ILC_COLOR, 0, 4); CDC *bmCDC; CBitmap *bm; CDC* pdc = GetDC(); bmCDC->CreateCompatibleDC(pdc); bm->CreateCompatibleDC(pdc,60,30); bmCDC->SelectObject(bm); bmCDC->TextOut ...... write something or draw m_imageList.Add(bmCDC->GetCurrentBitmap(), RGB(0, 0, 0)); ... .. . //more init code (not important) } This is not working, i think is something about init CDC (GetCDC() ) but i don`t now what exactly, can anyone help me please. |