How can I place a MFC CFormView inside a CDockable

2019-04-08 16:08发布

How can I place a MFC CFormView inside a CDockablePane which was introduced in the VS 2008 MFC Feature Pack?

5条回答
相关推荐>>
2楼-- · 2019-04-08 16:12

There is a sample of the feature pack that does this.

However, what I do is the following: I made a CDialog-derived class that I put in the DockablePane. Then I make a CFormView-derived class and make an instance of that a member variable of the dockable pane. Every function that I'm interested in (most likely UpdateView() or whatever it's called), I forward to the CDialog-derived class. That way I can sidestep the difficulties of shoehorning the doc/view structure into my application and still get the benefits.

查看更多
甜甜的少女心
3楼-- · 2019-04-08 16:15

Check the BCGSoft Samples for doing this with a cview. The class names are a little different but its more or less the same stuff since they provided CDockablePane to Microsoft.

查看更多
兄弟一词,经得起流年.
4楼-- · 2019-04-08 16:20

Actually there are a few ways of doing this.

If you derive your own CFameWnd class and then put an instance of that class in the CDockable pane you now can put whatever type of framework that you want inside of that CFrameWnd derived class.

The trick is to make sure that you are doing the creation in the correct order. If you try to call it to early then your internal views will never be created.

查看更多
不美不萌又怎样
5楼-- · 2019-04-08 16:26

I couldn't find such samples in MFC Feature Pack samples.

All projects containing CFormView are :

TasksPane TabControl TabbedView StatusBarDemo SetPaneSize MenuSubSet

But in any of the projects, CFormView is not embedded in CDockablePane.

查看更多
贪生不怕死
6楼-- · 2019-04-08 16:33

Probably this cab be a clue.

http://www.codeproject.com/KB/toolbars/sizecbar.aspx

Although it doesn't use CDockablePane, concept behind it is same. I didn't try CDockablePane and CFormView work like the one explained in the page yet, but by taking a glance at it, I feel that things are similar.

查看更多
登录 后发表回答