我現(xiàn)在想把CButton重新封裝下,一開(kāi)始就遇見(jiàn)了問(wèn)題,希望大家?guī)兔χ笇?dǎo)下
////////////////////////////////////////TCButton.h
#ifndef TCButton_H_
#define TCButton_H_
class TCButton:public CButton
{
public:
?//! Standard constructor.
?TCButton();
?//! Standard destructor.
?virtual ~TCButton();
};
#endif
////////////////////////////////////////TCButton.cpp
#include "stdafx.h"
#include "TCButton.h"
TCButton::TCButton()
{
?Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,CRect(0,0,40,20), this, 1);
}
TCButton::~TCButton()
{
}
現(xiàn)在我想在另外的Dailog中使用這個(gè)Button的話,我想實(shí)現(xiàn)
我想在堆內(nèi)存中TCButton myButton;
然后再進(jìn)行父窗口的指定myButton.SetParent(CWnd* pWnd);
這樣的效果怎么做啊?
如果是new出來(lái)的好辦,我可以引用帶參數(shù)的構(gòu)造函數(shù),傳入
Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,CRect(0,0,40,20), this, 1)的第3個(gè)參數(shù)CWnd* pParentCwnd
,但是如果我聲明在.h文件中呢? 我不知道怎么做 呵呵
希望能給點(diǎn)提示:)