CDC BitBlt problem
-
hello, I have a big problem ... I have created a MFC app from wizard ... and added: void CEditorView::OnInitialUpdate() { CScrollView::OnInitialUpdate(); CSize sizeTotal; // TODO: calculate the total size of this view sizeTotal.cx = widthMM; sizeTotal.cy = heightMM; SetScrollSizes(MM_LOMETRIC, sizeTotal); } so, my maping mode is MM_LOMETRIC ... and in OnDraw .... void CEditorView::OnDraw(CDC* pDC) { CEditorDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here CDC bdc; bdc.CreateCompatibleDC(pDC); CBitmap cb; cb.CreateCompatibleBitmap(pDC, 1000,1000); bdc.SelectObject(cb); bdc.SelectStockObject(WHITE_BRUSH); bdc.PatBlt(0,0,1000, 1000, PATCOPY); bdc.SelectStockObject(BLACK_BRUSH); bdc.Rectangle(CRect(0, 0, 500, -500)); pDC->StretchBlt(0, 0, 1000, 1000, &bdc, 0, 0, 1000, 1000, SRCCOPY); } and nothing happens .... why ????? I tried to change the sign of the coordonate values and still nothing ... How can I create a compatible DC with my DC and to paint in it ????? please help !!!.... thanks ......
-
hello, I have a big problem ... I have created a MFC app from wizard ... and added: void CEditorView::OnInitialUpdate() { CScrollView::OnInitialUpdate(); CSize sizeTotal; // TODO: calculate the total size of this view sizeTotal.cx = widthMM; sizeTotal.cy = heightMM; SetScrollSizes(MM_LOMETRIC, sizeTotal); } so, my maping mode is MM_LOMETRIC ... and in OnDraw .... void CEditorView::OnDraw(CDC* pDC) { CEditorDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here CDC bdc; bdc.CreateCompatibleDC(pDC); CBitmap cb; cb.CreateCompatibleBitmap(pDC, 1000,1000); bdc.SelectObject(cb); bdc.SelectStockObject(WHITE_BRUSH); bdc.PatBlt(0,0,1000, 1000, PATCOPY); bdc.SelectStockObject(BLACK_BRUSH); bdc.Rectangle(CRect(0, 0, 500, -500)); pDC->StretchBlt(0, 0, 1000, 1000, &bdc, 0, 0, 1000, 1000, SRCCOPY); } and nothing happens .... why ????? I tried to change the sign of the coordonate values and still nothing ... How can I create a compatible DC with my DC and to paint in it ????? please help !!!.... thanks ......
...but I not took real time to dig your code enough ! BTW, have a look at my own code (which work in every case), and find out how it works ;) Tips, look in CSkinProgress::OnPaint() ! http://www.codeproject.com/miscctrl/CSkinProgress.asp Kochise PS : Use CSkinProgress::ConvBitmap(...) to convert your bitmap from another color map if for instance, you are trying to display a 24 bits/pixel picture on a 16 or 32 bits/pixel screen ! Otherwise you'll get a black/blank screen instead ! In Cod we trust !
-
hello, I have a big problem ... I have created a MFC app from wizard ... and added: void CEditorView::OnInitialUpdate() { CScrollView::OnInitialUpdate(); CSize sizeTotal; // TODO: calculate the total size of this view sizeTotal.cx = widthMM; sizeTotal.cy = heightMM; SetScrollSizes(MM_LOMETRIC, sizeTotal); } so, my maping mode is MM_LOMETRIC ... and in OnDraw .... void CEditorView::OnDraw(CDC* pDC) { CEditorDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); // TODO: add draw code for native data here CDC bdc; bdc.CreateCompatibleDC(pDC); CBitmap cb; cb.CreateCompatibleBitmap(pDC, 1000,1000); bdc.SelectObject(cb); bdc.SelectStockObject(WHITE_BRUSH); bdc.PatBlt(0,0,1000, 1000, PATCOPY); bdc.SelectStockObject(BLACK_BRUSH); bdc.Rectangle(CRect(0, 0, 500, -500)); pDC->StretchBlt(0, 0, 1000, 1000, &bdc, 0, 0, 1000, 1000, SRCCOPY); } and nothing happens .... why ????? I tried to change the sign of the coordonate values and still nothing ... How can I create a compatible DC with my DC and to paint in it ????? please help !!!.... thanks ......
bdc.SelectObject(cb); try bdc.SelectObject(&cb); -c CheeseWeasle