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 關注
- 1023 瀏覽
添加回答
舉報