Solved

Can't see a picture which combine from CImageList

Posted on 2003-12-04
4
290 Views
Last Modified: 2013-11-20
Hi,
I have a list of pics which combine to one picture ,and i can see it on the Image rect
when the background is not painted,but if i paint the background i can't see it any more
i just see now an empty space where it should be.
What should i do?
///////////////////////Fixed code after your help//////////////
CRect rect;
CRect rect1;
m_cMouth.GetWindowRect(&rect1);    // screen coordinates
 ScreenToClient(&rect1);            // client coordinates
CPaintDC dc(this);
dc.ExcludeClipRect(rect1);
CPen p[64];
int i,factor;
GetClientRect(&rect);
factor=rect.bottom/63;
for(i=0;i<64;i++)
   p[i].CreatePen(PS_SOLID,1,RGB(250,120+i*2,0));
for(i=0;i<rect.bottom;i++)
    {
      dc.SelectObject(&p[i/factor]);
      dc.MoveTo(0,i);
      dc.LineTo(rect.right,i);
   }
/* If i put this code in comments i can see the pics*/



///////////////////////////////////////////////////////////

CPaintDC dc(this);
CDialog::OnPaint();
// Draw into memory DC
m_cMouthList.Draw(&dc, 0, m_cMouthRect.TopLeft(), INDEXTOOVERLAYMASK(m_iMouthBmp));
if (m_iMouthBmp % 6 == 2)
 {
    m_cMouthList.Draw(&dc, WEYESNAR, m_cMouthRect.TopLeft(), 0 );
 }
else if (m_iMouthBmp % 6 == 5)
 {
   m_cMouthList.Draw(&dc, WEYESCLO, m_cMouthRect.TopLeft(), 0 );
 }


///////////////////////////////////////////////////////////////////////////


InitMouthImageList()
{
     m_cMouth.GetClientRect(&m_cMouthRect);
     m_cMouth.ClientToScreen(&m_cMouthRect);
     ScreenToClient(&m_cMouthRect);

     CBitmap bmp;
                m_cMouthList.Create(CHARACTER_WIDTH, CHARACTER_HEIGHT, ILC_COLOR32  
                |ILC_MASK, 1, 0);

     bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MICFULL));
     m_cMouthList.Add(&bmp, RGB(255,0,255));
     bmp.Detach();
     
     bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MICMOUTH2));
     m_cMouthList.Add(&bmp, RGB(255,0,255));
     bmp.Detach();
     
     bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MICMOUTH3));
     m_cMouthList.Add(&bmp, RGB(255,0,255));
     bmp.Detach();
     
     bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MICMOUTH4));
     m_cMouthList.Add(&bmp, RGB(255,0,255));
     bmp.Detach();
     
     bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MICMOUTH5));
     m_cMouthList.Add(&bmp, RGB(255,0,255));
     bmp.Detach();
     
     bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MICMOUTH6));
     m_cMouthList.Add(&bmp, RGB(255,0,255));
     bmp.Detach();
     
     bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MICMOUTH7));
     m_cMouthList.Add(&bmp, RGB(255,0,255));
     bmp.Detach();
     
     bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MICMOUTH8));
     m_cMouthList.Add(&bmp, RGB(255,0,255));
     bmp.Detach();
     
     bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MICMOUTH9));
     m_cMouthList.Add(&bmp, RGB(255,0,255));
     bmp.Detach();
     
     bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MICMOUTH10));
     m_cMouthList.Add(&bmp, RGB(255,0,255));
     bmp.Detach();
     
     bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MICMOUTH11));
     m_cMouthList.Add(&bmp, RGB(255,0,255));
     bmp.Detach();
     
     bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MICMOUTH12));
     m_cMouthList.Add(&bmp, RGB(255,0,255));
     bmp.Detach();
     
     bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MICMOUTH13));
     m_cMouthList.Add(&bmp, RGB(255,0,255));
     bmp.Detach();
     
     bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MICEYESNAR));
     m_cMouthList.Add(&bmp, RGB(255,0,255));
     bmp.Detach();
     
     bmp.LoadBitmap(MAKEINTRESOURCE(IDB_MICEYESCLO));
     m_cMouthList.Add(&bmp, RGB(255,0,255));
     bmp.Detach();
     
     m_cMouthList.SetOverlayImage(1, 1);
     m_cMouthList.SetOverlayImage(2, 2);
     m_cMouthList.SetOverlayImage(3, 3);
     m_cMouthList.SetOverlayImage(4, 4);
     m_cMouthList.SetOverlayImage(5, 5);
     m_cMouthList.SetOverlayImage(6, 6);
     m_cMouthList.SetOverlayImage(7, 7);
     m_cMouthList.SetOverlayImage(8, 8);
     m_cMouthList.SetOverlayImage(9, 9);
     m_cMouthList.SetOverlayImage(10, 10);
     m_cMouthList.SetOverlayImage(11, 11);
     m_cMouthList.SetOverlayImage(12, 12);
     m_cMouthList.SetOverlayImage(13, 13);
     m_cMouthList.SetOverlayImage(14, WEYESNAR);
     m_cMouthList.SetOverlayImage(15, WEYESCLO);

     return TRUE;
}
0
Comment
Question by:dani333
4 Comments
 

Expert Comment

by:desabhotlas
ID: 9910622
try using CDC object instead of CPaintDC, use CPaintDC only in OnPaint function

CDC *pdc = GetDC();
.
.
..


0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 11992050
PAQed - no points refunded (of 100)

Computer101
E-E Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 84
Doc'in system (example?) BA 7 89
bigDiff challenge 17 85
abstract class with all non abstract mentods 6 76
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now