4 回答
TA貢獻(xiàn)1772條經(jīng)驗(yàn) 獲得超6個(gè)贊
在CDialog1中包含CRubberbandView的頭文件
在CDialog1的ONOK()函數(shù)中定義一個(gè)CRubberbandView的對(duì)象rb
調(diào)用函數(shù) rb. bresenham
試下可以不
TA貢獻(xiàn)1848條經(jīng)驗(yàn) 獲得超2個(gè)贊
用指針:
//B.h
class B
{
public:
Fun();
};
CB * GetB(); //全局函數(shù)
//B.CPP
CB g_B;
CB * GetB()
{
return &g_B;
}
//A.cpp
#include "B.h"
GetB().Fun(); //可以這樣調(diào)用B中的成員函數(shù)Fun()
TA貢獻(xiàn)1775條經(jīng)驗(yàn) 獲得超11個(gè)贊
想辦法獲得CRubberbandView的一個(gè)指針,用指針調(diào)用那個(gè)函數(shù)
如果你那個(gè)View已經(jīng)注冊(cè)過,且處于active 狀態(tài),可用
//#include "mainframe.h"
//#inlcude "ruberandview.h"
CMainFrame *pMain=(CMainFrame *)AfxGetApp()-> m_pMainWnd;
CRubberbandView *pView=(CRubberbandView *)pMain-> GetActiveView();
pView->bresenham();
TA貢獻(xiàn)1824條經(jīng)驗(yàn) 獲得超8個(gè)贊
//#include "mainframe.h"
//#inlcude "ruberandview.h"
CMainFrame *pMain=(CMainFrame *)AfxGetApp()-> m_pMainWnd;
CRubberbandView *pView=(CRubberbandView *)pMain-> GetActiveView();
pView->bresenham();
- 4 回答
- 0 關(guān)注
- 1053 瀏覽
添加回答
舉報(bào)
