如何限制MDI选项卡组的数量

如何限制MDI选项卡组的数量

本文介绍了如何限制MDI选项卡组的数量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我已经创建了具有标签式组的MDI应用程序..

I have created a MDI application with tabbed group.

每次我从选项卡栏拖放一个选项卡进行查看时,都会创建一个新的选项卡组并根据选项卡组的数量划分视图.但是我想允许我的应用程序仅创建两个选项卡组.

Each time I drag and drop one tab from tab bar to view, it will create a new tab group and divide view according to the number of tab groups. But I want to allow my application to create only two tab groups.

我已经完成工作,将一个新的标签组与与拖放标签相关的标签组重新分组.

I have done my work by regrouping a new tab group with the tab group related to the drag-and-drop tab.

但是此解决方案不好,因为视图会短暂闪烁.

But this solution is not good because the view blinks for a short time.

我正在寻找更好的解决方案.我知道:拖放选项卡以查看=>创建新选项卡组是MDI选项卡组的默认支持.

I'm looking for a better solution. I know: drag-and-drop tab to view => create new tab group is default support by MDI Tabbed Group.

如何检查并防止它?

推荐答案

根据消息AFX_WM_ON_MOVETABCOMPLETE(已注册的Windows消息)完成分离和移动Tabs区域的完整工作,此消息由CMDIClientAreaWnd :: OnMoveTabComplete处理.

The complete job of detaching and moving the Tabs arround is done upon the message AFX_WM_ON_MOVETABCOMPLETE (registered Windows message), this message is handled by CMDIClientAreaWnd::OnMoveTabComplete.

因此,您可以继承MDI客户端窗口的类,并可以截取消息.检查所需的内容,如果不想执行拖放操作,则只需返回即可.

So you can subclass your MDI client window and you can intercept the message.Check what you want, and if you don't want to allow the drag&drop Operation just return.

如果要允许此拖放操作,只需调用基本实现CMDIClientAreaWnd :: OnMoveTabComplete.

If you want to allow this drag&drop just call the base implementation CMDIClientAreaWnd::OnMoveTabComplete.

这篇关于如何限制MDI选项卡组的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 20:42