MFC 重载Button类后出现的问题
重载一个button类后,调用出现问题
调用的代码
CWnd* pParentWnd;
pParentWnd=GetForegroundWindow() ; //获得当前窗口的指针
BUTTONTS btn;
btn.Create(_T("按钮"),_T("图书管理功能"),WS_CHILD|WS_VISIBLE|BS_DEFPUSHBUTTON,CRect (20,20,100,40),pParentWnd,123);
btn.ShowWindow(SW_SHOWMAXIMIZED);
重载的类中create函数的代码
BUTTONTS::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
dwStyle |= BS_OWNERDRAW;
return CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext);
}