Click here to Skip to main content
15,918,742 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionnot installaing visual studio .Net 2003 in vista? Pin
rowdy_vc++18-Mar-08 18:55
rowdy_vc++18-Mar-08 18:55 
AnswerRe: not installaing visual studio .Net 2003 in vista? Pin
Naveen18-Mar-08 19:18
Naveen18-Mar-08 19:18 
AnswerRe: not installaing visual studio .Net 2003 in vista? Pin
Rajesh R Subramanian18-Mar-08 22:05
professionalRajesh R Subramanian18-Mar-08 22:05 
AnswerRe: not installaing visual studio .Net 2003 in vista? Pin
David Crow19-Mar-08 4:23
David Crow19-Mar-08 4:23 
GeneralStructure array initialization error Pin
LiYS18-Mar-08 18:53
LiYS18-Mar-08 18:53 
GeneralRe: Structure array initialization error Pin
Naveen18-Mar-08 19:08
Naveen18-Mar-08 19:08 
QuestionRe: Structure array initialization error Pin
ThatsAlok18-Mar-08 20:00
ThatsAlok18-Mar-08 20:00 
QuestionHow to show a bitmap in a CStatic control? Pin
fantasy121518-Mar-08 17:55
fantasy121518-Mar-08 17:55 
In the default CAboutDlg, I just erase all controls. And I add a CStatic control. I just want to show a bitmap in the CStatic control.
And I also import a bitmap file to the resource.
my codes:

The header file
class CAboutDlg : public CDialog
{
  CBitmap m_bitmap;
  CStatic m_ctlPic;
}

The cpp file:
CAboutDlg::CAboutDlg()
{
  m_bitmap.LoadBitmap(IDB_BITMAP1);
}
CAboutDlg::~CAboutDlg()
{
  if (m_bitmap.GetSafeHandle())
    m_bitmap.DeleteObject();
}

BEGIN_MESSAGE_MAP()
  ON_WM_PAINT()
END_MESSAGE_MAP()

void CAboutDlg::OnPaint()
{
CPaintDC dc(this);
CRect rcWnd;
m_ctlPic.GetWindowRect(&rcWnd);
this->ScreenToClient(&rcWnd);
BITMAP bm = {0};
m_bitmap.SelectObject(&bm);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
dcMem.SelectObject(&m_bitmap);
dc.StretchBlt(rcWnd.left, rcWnd.top, rcWnd.Width(), rcWnd.Height(), &dcMem, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY);
}

But when I open the CAboutDlg, the bitmap shows flash, and vanish immediately, Please tell me what's wrong in my mind?
GeneralRe: How to show a bitmap in a CStatic control? Pin
Naveen18-Mar-08 18:31
Naveen18-Mar-08 18:31 
GeneralRe: How to show a bitmap in a CStatic control? Pin
MANISH RASTOGI18-Mar-08 18:35
MANISH RASTOGI18-Mar-08 18:35 
QuestionRe: How to show a bitmap in a CStatic control? Pin
fantasy121518-Mar-08 19:11
fantasy121518-Mar-08 19:11 
GeneralRe: How to show a bitmap in a CStatic control? Pin
Mark Salsbery18-Mar-08 20:14
Mark Salsbery18-Mar-08 20:14 
QuestionRe: How to show a bitmap in a CStatic control? Pin
fantasy121518-Mar-08 20:26
fantasy121518-Mar-08 20:26 
GeneralRe: How to show a bitmap in a CStatic control? Pin
Mark Salsbery18-Mar-08 20:35
Mark Salsbery18-Mar-08 20:35 
QuestionRe: How to show a bitmap in a CStatic control? Pin
Rajkumar R18-Mar-08 19:25
Rajkumar R18-Mar-08 19:25 
GeneralGetting the value when u point to a particular position Pin
Chandrasekharan P18-Mar-08 16:43
Chandrasekharan P18-Mar-08 16:43 
GeneralRe: Getting the value when u point to a particular position Pin
Steve Echols18-Mar-08 19:30
Steve Echols18-Mar-08 19:30 
GeneralRe: Getting the value when u point to a particular position Pin
ThatsAlok18-Mar-08 19:56
ThatsAlok18-Mar-08 19:56 
Questioncan DirectSound and DirectShow work at the same time? Pin
mwolf12218-Mar-08 15:57
mwolf12218-Mar-08 15:57 
AnswerRe: can DirectSound and DirectShow work at the same time? Pin
Mark Salsbery18-Mar-08 16:28
Mark Salsbery18-Mar-08 16:28 
GeneralOpaque COleClientItem Pin
Kyudos18-Mar-08 13:30
Kyudos18-Mar-08 13:30 
GeneralConverting int to string Pin
J_E_D_I18-Mar-08 9:19
J_E_D_I18-Mar-08 9:19 
GeneralRe: Converting int to string Pin
Maxwell Chen18-Mar-08 9:27
Maxwell Chen18-Mar-08 9:27 
GeneralRe: Converting int to string Pin
Mark Salsbery18-Mar-08 9:41
Mark Salsbery18-Mar-08 9:41 
GeneralRe: Converting int to string Pin
Joe Woodbury18-Mar-08 15:57
professionalJoe Woodbury18-Mar-08 15:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.