4 回答

TA贡献1772条经验 获得超6个赞
在CDialog1中包含CRubberbandView的头文件
在CDialog1的ONOK()函数中定义一个CRubberbandView的对象rb
调用函数 rb. bresenham
试下可以不

TA贡献1848条经验 获得超2个赞
用指针:
//B.h
class B
{
public:
Fun();
};
CB * GetB(); //全局函数
//B.CPP
CB g_B;
CB * GetB()
{
return &g_B;
}
//A.cpp
#include "B.h"
GetB().Fun(); //可以这样调用B中的成员函数Fun()

TA贡献1775条经验 获得超11个赞
想办法获得CRubberbandView的一个指针,用指针调用那个函数
如果你那个View已经注册过,且处于active 状态,可用
//#include "mainframe.h"
//#inlcude "ruberandview.h"
CMainFrame *pMain=(CMainFrame *)AfxGetApp()-> m_pMainWnd;
CRubberbandView *pView=(CRubberbandView *)pMain-> GetActiveView();
pView->bresenham();

TA贡献1824条经验 获得超8个赞
//#include "mainframe.h"
//#inlcude "ruberandview.h"
CMainFrame *pMain=(CMainFrame *)AfxGetApp()-> m_pMainWnd;
CRubberbandView *pView=(CRubberbandView *)pMain-> GetActiveView();
pView->bresenham();
- 4 回答
- 0 关注
- 990 浏览
添加回答
举报