CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2006
    Posts
    24

    displaying bitmap

    hello all..after refering to the past posts on displaying bitmaps...

    i tried the following codes in OnDraw

    Code:
    	CBitmap bmp;
    	bmp.LoadBitmap(IDB_BITMAP1);
    
    	BITMAP bm;
    
    	bmp.GetObject(sizeof(BITMAP), &bm);
    
    	CDC memDC;
    
    	memDC.CreateCompatibleDC(pDC);
    
    	CBitmap* pOld = memDC.SelectObject(&bmp);
    
    	pDC->BitBlt(50, 50, bm.bmWidth, bm.bmHeight, &memDC, 50, 50 , SRCCOPY);
    
    	memDC.SelectObject(pOld);
    But after running the program, nothing is being display. Please help see where the error might be.

    Thanks alot!

  2. #2
    Join Date
    Nov 2005
    Location
    India, Kerala, Trivandrum
    Posts
    37

    Re: displaying bitmap

    pDC->BitBlt(50, 50, bm.bmWidth, bm.bmHeight, &memDC, 50, 50 , SRCCOPY);
    pDC->BitBlt(50, 50, bm.bmWidth, bm.bmHeight, &memDC, 0, 0, SRCCOPY);

  3. #3
    Join Date
    Dec 2005
    Posts
    67

    Re: displaying bitmap

    Quote Originally Posted by ljaydenl
    hello all..after refering to the past posts on displaying bitmaps...

    i tried the following codes in OnDraw

    Code:
    	CBitmap bmp;
    	bmp.LoadBitmap(IDB_BITMAP1);
    
    	BITMAP bm;
    
    	bmp.GetObject(sizeof(BITMAP), &bm);
    
    	CDC memDC;
    
    	memDC.CreateCompatibleDC(pDC);
    
    	CBitmap* pOld = memDC.SelectObject(&bmp);
    
    	pDC->BitBlt(50, 50, bm.bmWidth, bm.bmHeight, &memDC, 50, 50 , SRCCOPY);
    
    	memDC.SelectObject(pOld);
    But after running the program, nothing is being display. Please help see where the error might be.

    Thanks alot!


    Check if IDB_BITMAP1 is there in your project resource or something..

  4. #4
    Join Date
    May 2005
    Posts
    4,954

    Re: displaying bitmap

    this thread can help: Help with displaying bitmaps

    Cheers
    If a post helped you dont forget to "Rate This Post"

    My Article: Capturing Windows Regardless of Their Z-Order

    Cheers

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured