CBitmap, CButton HBIMAP and more..
-
This function do not work, why... CSpecialControl is derived from CWnd BOOL CSpecialControl::Create(const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) { BOOL Oktemp; //after this line hbm is null, IDB_BITMAP1 is a valid resource... //why it does'nt work? How I am supposed to use it? HBITMAP hbm = ::LoadBitmap(NULL,MAKEINTRESOURCE(IDB_BITMAP1)); //this work CBitmap MyBitmap; MyBitmap.LoadBitmap( IDB_BITMAP1); //this work Oktemp = CWnd::Create (NULL,_T(""),WS_CHILD|WS_CLIPCHILDREN, rect, pParentWnd, nID ,pContext); //this work, I can see the button and catch his command Oktemp &= m_cBouton_1.Create (_T(""),WS_CHILD |BS_PUSHBUTTON|BS_BITMAP|WS_VISIBLE ,CRect(0,0,100,100),this,IDC_BUTTONGAUCHE); //and the bitmap is never displayed on the button.... //do I have to set a different Style ti my button? m_cBouton_1.SetBitmap(MyBitmap); m_cBouton_1.ShowWindow(SW_SHOWNORMAL); return Oktemp; } Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com
-
This function do not work, why... CSpecialControl is derived from CWnd BOOL CSpecialControl::Create(const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) { BOOL Oktemp; //after this line hbm is null, IDB_BITMAP1 is a valid resource... //why it does'nt work? How I am supposed to use it? HBITMAP hbm = ::LoadBitmap(NULL,MAKEINTRESOURCE(IDB_BITMAP1)); //this work CBitmap MyBitmap; MyBitmap.LoadBitmap( IDB_BITMAP1); //this work Oktemp = CWnd::Create (NULL,_T(""),WS_CHILD|WS_CLIPCHILDREN, rect, pParentWnd, nID ,pContext); //this work, I can see the button and catch his command Oktemp &= m_cBouton_1.Create (_T(""),WS_CHILD |BS_PUSHBUTTON|BS_BITMAP|WS_VISIBLE ,CRect(0,0,100,100),this,IDC_BUTTONGAUCHE); //and the bitmap is never displayed on the button.... //do I have to set a different Style ti my button? m_cBouton_1.SetBitmap(MyBitmap); m_cBouton_1.ShowWindow(SW_SHOWNORMAL); return Oktemp; } Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com
-
This function do not work, why... CSpecialControl is derived from CWnd BOOL CSpecialControl::Create(const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) { BOOL Oktemp; //after this line hbm is null, IDB_BITMAP1 is a valid resource... //why it does'nt work? How I am supposed to use it? HBITMAP hbm = ::LoadBitmap(NULL,MAKEINTRESOURCE(IDB_BITMAP1)); //this work CBitmap MyBitmap; MyBitmap.LoadBitmap( IDB_BITMAP1); //this work Oktemp = CWnd::Create (NULL,_T(""),WS_CHILD|WS_CLIPCHILDREN, rect, pParentWnd, nID ,pContext); //this work, I can see the button and catch his command Oktemp &= m_cBouton_1.Create (_T(""),WS_CHILD |BS_PUSHBUTTON|BS_BITMAP|WS_VISIBLE ,CRect(0,0,100,100),this,IDC_BUTTONGAUCHE); //and the bitmap is never displayed on the button.... //do I have to set a different Style ti my button? m_cBouton_1.SetBitmap(MyBitmap); m_cBouton_1.ShowWindow(SW_SHOWNORMAL); return Oktemp; } Remi Morin Rmorin@Operamail.com Remi.Morin@Lyrtech.com
The
MyBitmap
goes out of scope, so the bitmap is destroyed. Make the object a member variable so it stays around for the life of the control. --Mike-- http://home.inreach.com/mdunn/ A recent survey reports that 1/4 of all internet users in England surf for porn. The other 3/4 just didn't want to admit it.