如何确定/确定(无论是从控制条还是从它所连接到的框架) CControlBar连接到的帧的哪一边?
我知道你可以:
但我不知道怎么找回它停靠在哪一边。希望有一个像CurrentlyDockedTo()这样的方法可以返回CBRS_ALIGN_TOP、AFX_IDW_DOCKBAR_TOP .
我在寻找最快的方法来找出主窗口中还有多少灰色空间.灰色矩形的大小。
发布于 2016-03-18 20:05:11
我对我的问题找到了一个非常简单的解决办法。这正是我需要的答案。在下面的帖子中找到了引导我走上正确道路的最初提示:
Detecting when a CControlBar's docking state has changed
我所要求的守则如下:
CPtrList& list = this->m_listControlBars;
POSITION pos = list.GetHeadPosition();
int total_cntrl_bars_found = 0;
while(pos)
{
CControlBar* pBar = (CControlBar*)list.GetNext(pos);
if(pBar)
{
if(!pBar->IsFloating())
{
total_cntrl_bars_found++;
int total_matched_styles = 0;
DWORD bar_style = pBar->GetBarStyle();
if(bar_style & CBRS_ORIENT_VERT)
{
// Then the bar is vertially oriented
// Will additionally also pass either the
// right oriented or left oriented check depending
total_matched_styles++;
}
if(bar_style & CBRS_ORIENT_HORZ)
{
// Then the bar is vertially oriented
total_matched_styles++;
}
if(bar_style & CBRS_ALIGN_RIGHT)
{
// Then the bar is right aligned
total_matched_styles++;
}
if(bar_style & CBRS_ALIGN_LEFT)
{
// Then the bar is left aligned
total_matched_styles++;
}
// There is also a check for top align
// and bottom aligned
}
}
} 下面是关于GetBarStyle()的更多信息
发布于 2016-03-18 03:49:47
您应该能够使用GetBarStyle。
https://stackoverflow.com/questions/36073991
复制相似问题