Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CDC BitBlt problem

CDC BitBlt problem

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _crs_
    wrote on last edited by
    #1

    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 ......

    K C 2 Replies Last reply
    0
    • _ _crs_

      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 ......

      K Offline
      K Offline
      Kochise
      wrote on last edited by
      #2

      ...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 !

      1 Reply Last reply
      0
      • _ _crs_

        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 ......

        C Offline
        C Offline
        Chris Losinger
        wrote on last edited by
        #3

        bdc.SelectObject(cb); try bdc.SelectObject(&cb); -c CheeseWeasle

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups