المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : how to create a button in cview class?



C++ Programming
02-10-2010, 12:23 AM
Hi...

I am using Visual Studio 2008, and i am working with a multiple document application, it is CView Based. In CView how can i add cbutton?

My code is,
CRect button1Rect;
CButton button1;
button1Rect.SetRect(250,75,400,100);
button1.Create(_T("HI"),WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,button1Rect,this,1);
button1.ShowWindow(SW_SHOW);
the above code not showing the cbutton.

but if the code is like,
CRect button1Rect;
CButton button1;
button1Rect.SetRect(250,75,400,100);
button1.Create(_T("HI"),WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,button1Rect,this,1);
button1.ShowWindow(SW_SHOW);
AfxMessageBox(L"Button created");
It shows the button.

How to solve this problem?

Any help will be appreciated.

Thanks...G.Paulraj