Bitmap button dose not displayed
-
I have created a SDI application (with no Document/View) support. I 'm trying to attach a
CBitmap
button, but dose not displayed at all. Here is my code (that handles theWM_CREATE
message on theCChildView
class):int CChildView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CWnd::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here RECT rect; rect.left = 20; rect.right = rect.left + 20; rect.top = 100; rect.bottom = rect.top + 20; CBitmapButton bnPlay; if(bnPlay.Create(NULL, WS_CHILD|WS_VISIBLE|BS_OWNERDRAW, CRect(&rect), this, IDC_BN_PLAY)==0) { AfxMessageBox("BnPlay cannot be created", MB_ICONSTOP); return -1; } //IDB_BNPLAY is the resource bitmap bnPlay.LoadBitmaps(IDB_BNPLAY/*, 0, 0, 0*/); bnPlay.SizeToContent(); return 0; }
The result of this code is an empty window... :mad: -
I have created a SDI application (with no Document/View) support. I 'm trying to attach a
CBitmap
button, but dose not displayed at all. Here is my code (that handles theWM_CREATE
message on theCChildView
class):int CChildView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CWnd::OnCreate(lpCreateStruct) == -1) return -1; // TODO: Add your specialized creation code here RECT rect; rect.left = 20; rect.right = rect.left + 20; rect.top = 100; rect.bottom = rect.top + 20; CBitmapButton bnPlay; if(bnPlay.Create(NULL, WS_CHILD|WS_VISIBLE|BS_OWNERDRAW, CRect(&rect), this, IDC_BN_PLAY)==0) { AfxMessageBox("BnPlay cannot be created", MB_ICONSTOP); return -1; } //IDB_BNPLAY is the resource bitmap bnPlay.LoadBitmaps(IDB_BNPLAY/*, 0, 0, 0*/); bnPlay.SizeToContent(); return 0; }
The result of this code is an empty window... :mad:The
CWnd
dtor destroys the window that theCWnd
is managing, so whenbnPlay
goes out of scope, the button gets destroyed. --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | 1ClickPicGrabber | NEW~! CP SearchBar v3.0 | C++ Forum FAQ Strange things are afoot at the U+004B U+20DD