SDI如何在Splitter的Tabview中动态建立HtmlView,在SDI中划分两部分,上面是FormView,下部分是MyFrameWndBar包含一个TabView,我想在TabView按照需要动态生成HtmlView, 可是怎么创建View都不能显示,谁能告诉我或者提供实例。急盼中...
解决方案 »
- vc和时间赛跑,可行否
- MFC中的静态控件 烦!
- HELP !! 我的VC++程序里面 断点调试 后,总进入一个汇编调试界面 ???
- 紧急请教高手,小弟是MFC菜鸟,最近在编一个播放器的界面..类似金山影霸的界面,已经能显示一个对话框的BMP图片,但是做不出金山解霸的另一个
- ActiveMovie如何释放文件?
- 如何用socket编程下载一个图像文件?各位高手请帮忙。100分
- 有关扇区读写的问题
- 在VC里有类似VB的StrConv()吗,我想将字符转换成Unicode
- 为什么程序的debug版不能运行而release版则可以?
- 好像无法透明呀?
- 调用vc写的dll问题,dll中的全局变量值丢失
- 怎么改变文本编辑控件中的某几个字的颜色?
你总是可以用对话框或者FormView+浏览器控件来替代使用CHTMLView。
CCreateContext* pContext)
{ SIZE size1;
CRect rect;
GetClientRect(&rect); size1.cx = rect.right/2 ;
size1.cy = rect.bottom/2; m_wndSplit.CreateStatic(this, 2,1,WS_CHILD|WS_VISIBLE|WS_CLIPCHILDREN|WS_CLIPSIBLINGS, AFX_IDW_PANE_FIRST );
m_wndSplit.CreateView(0,0,RUNTIME_CLASS(CMyFormView), size1,
pContext); // Create the view using a CFrameWnd derived class.
m_wndSplit.CreateView(1,0,RUNTIME_CLASS(CMyFrameWndBar), size1,
pContext);
m_wndSplit.RecalcLayout();
RecalcLayout();
return TRUE;
}//CMyFrameWndBar : public CXTFrameWnd
BOOL CMyFrameWndBar::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
m_MyTabView = (CMyTabView *) CreateView(pContext, AFX_IDW_PANE_FIRST); if (m_MyTabView == NULL)
return FALSE; return CXTFrameWnd::OnCreateClient(lpcs, pContext);
}//class CMyTabView : public CXTTabView
int CMyTabView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CXTTabView::OnCreate(lpCreateStruct) == -1)
return -1;
/* //不屏蔽该段能出两个tab,但若在CMyWebView中添加激活调用Navigate即出错
CRuntimeClass *pNewViewClass1 = RUNTIME_CLASS(CMyWebView);
CRuntimeClass *pNewViewClass2 = RUNTIME_CLASS(CMyWebView);
AddView("Wicked Code",pNewViewClass1,NULL,NULL,-1,-1);
AddView("Creating Sophisticated Tabbed",pNewViewClass2,NULL,NULL,-1,-1);
GetTabCtrl().SetMinTabWidth(64);
GetTabCtrl().ModifyStyleEx(WS_EX_CLIENTEDGE,0,0);
SetActiveView(1);
*/
// return 1; //0
}
class CMyWebView : public CHtmlView//想在CMainFrame动态创建tab中的htmlview,可是不能显示
void CMainFrame::OnDynNewHtmlView()
{
// TODO: Add your command handler code here CCreateContext createContext; pNewViewClass3 = RUNTIME_CLASS(CMyWebView);
// 设 置CreateContext 相 关 字 段
createContext.m_pNewViewClass = pNewViewClass3;
createContext.m_pCurrentDoc = NULL;
//createContext.m_pCurrentDoc = MyFrameWndBar->GetActiveDocument(); createContext.m_pNewDocTemplate = NULL;
//
// CMyWebView* pNewView = MyFrameWndBar->m_MyTabView->CreateTabView(pNewViewClass3, NULL, &createContext);
int nReturn=(MyFrameWndBar->m_MyTabView)->AddView("test",pNewViewClass3,NULL,&createContext,-1,-1);
(MyFrameWndBar->m_MyTabView)->SetActiveView(2);
// m_wndSplit.RecalcLayout();
// RecalcLayout();
m_listViews.AddTail((CView*)pNewViewClass3);
}