编程实现基于MFC的Vega程序MFCWorkVega,调用刚建立的lynx:
1建立一个单文档的MFC程序,把在zsVegaView.cpp和zsVegaView.h包含进来
2.在MFCWorkVegaView的基类由CView改为zsVegaView,下面增加调用vega
的几个必须函数
const char* CMFCWorkVegaView::getAdfName()
{
CMFCWorkVegaDoc* doc = (CMFCWorkVegaDoc*)GetDocument();
const char* adfName = doc->GetPathName() ;
// If the filename was not given open "VegaWin.adf".
if ( strlen( adfName ) == 0 )
return "ocean.adf";
else
return adfName;
}
void CMFCWorkVegaView::postDefine()
{
vgWindow* win = vgGetWin(0);
vgWinSize( win, 0, SizeOfWinX, 0, SizeOfWinY );
}
void CMFCWorkVegaView::OnInitialUpdate()
{
CVegaView::OnInitialUpdate();
runVega(); //运行vega
}
void CMFCWorkVegaView::OnSize(UINT nType, int cx, int cy)
{
CVegaView::OnSize(nType, cx, cy);
SizeOfWinX=cx;
SizeOfWinY=cy;
// TOD Add your message handler code here
}
1建立一个单文档的MFC程序,把在zsVegaView.cpp和zsVegaView.h包含进来
2.在MFCWorkVegaView的基类由CView改为zsVegaView,下面增加调用vega
的几个必须函数
const char* CMFCWorkVegaView::getAdfName()
{
CMFCWorkVegaDoc* doc = (CMFCWorkVegaDoc*)GetDocument();
const char* adfName = doc->GetPathName() ;
// If the filename was not given open "VegaWin.adf".
if ( strlen( adfName ) == 0 )
return "ocean.adf";
else
return adfName;
}
void CMFCWorkVegaView::postDefine()
{
vgWindow* win = vgGetWin(0);
vgWinSize( win, 0, SizeOfWinX, 0, SizeOfWinY );
}
void CMFCWorkVegaView::OnInitialUpdate()
{
CVegaView::OnInitialUpdate();
runVega(); //运行vega
}
void CMFCWorkVegaView::OnSize(UINT nType, int cx, int cy)
{
CVegaView::OnSize(nType, cx, cy);
SizeOfWinX=cx;
SizeOfWinY=cy;
// TOD Add your message handler code here
}