您如何知道工具栏的停靠状态已更改 [英] How do you know when the docking state of a toolbar has changed
问题描述
有人问了类似的问题@ 检测CControlBar对接的时间状态已更改,但是答案是从控件的角度编写的.我想知道对接状态何时从CFrameWnd更改,因为我有一个窗口填充了工作区,只要对接状态发生变化,就需要重新定位该客户区.我当前的WM_SIZE代码有效,但是如果工具栏停靠或取消停靠,则无效.
Someone asked a similar question @ Detecting when a CControlBar's docking state has changed, but the answer is written from the standpoint of the control. I want to know when the docking state changes from CFrameWnd, because I have a window filling up the client area that needs to be repositioned whenever the docking state changes. My current WM_SIZE code works, but not if a toolbar is docked or undocked.
推荐答案
您可以覆盖CFrameWndEx
的AdjustDockingLayout
功能.
每次更改对接布局时都会调用它.
You could override the AdjustDockingLayout
function of CFrameWndEx
.
It will be called every time docking layout is changed.
注意: 在创建停靠窗口期间,有多次对此功能的调用(您可能希望忽略它们).
Note: During the creation of the Docking windows, there are multiple calls to this function (you might want to ignore them).
void CMainFrame::AdjustDockingLayout(HDWP hdwp)
{
CMDIFrameWndEx::AdjustDockingLayout(hdwp);
// do some calulations
}
这篇关于您如何知道工具栏的停靠状态已更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!