当前位置: 首页>>代码示例>>C++>>正文


C++ CDialog::GetWindowRect方法代码示例

本文整理汇总了C++中CDialog::GetWindowRect方法的典型用法代码示例。如果您正苦于以下问题:C++ CDialog::GetWindowRect方法的具体用法?C++ CDialog::GetWindowRect怎么用?C++ CDialog::GetWindowRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDialog的用法示例。


在下文中一共展示了CDialog::GetWindowRect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CreateAndPlaceDialogs

BOOL CTraceTabBaseDlg::CreateAndPlaceDialogs()
{
    m_TabCtrl.ModifyStyle(m_TabStyleRemove, m_TabStyleAdd);

    size_t NumDlg = m_TabDlgVec.size();
    LONG Width = 0, Height = 0;
    for(size_t i = 0 ; i < NumDlg; ++i)
    {
        m_TabCtrl.InsertItem(m_TabDlgVec[i].DialogId , m_TabDlgVec[i].TabName);

        CDialog* pChild = m_TabDlgVec[i].Child;
        int DialogId = m_TabDlgVec[i].DialogId;
        if (!pChild->Create(DialogId, this))
        {
            LogEvent(LE_ERROR, "CTraceTabBaseDlg::CreateAndPlaceDialogs: Failed to build dialog. IDD = %d", DialogId);
            Assert(false);
            return FALSE;
        }
        CRect ChildRect;
        pChild->GetWindowRect(&ChildRect);
        Width = max(Width, ChildRect.right - ChildRect.left);
        Height = max(Height, ChildRect.bottom - ChildRect.top);
    }

    CRect TabWindowRect;
    m_TabCtrl.GetWindowRect(&TabWindowRect);
    LONG TabWidth = TabWindowRect.right - TabWindowRect.left;
    LONG TabHeight = TabWindowRect.bottom - TabWindowRect.top;
    Width = max(Width+10, TabWidth);
    Height = max(Height, TabHeight);
    TabWindowRect.right = TabWindowRect.left + Width;
    TabWindowRect.bottom = TabWindowRect.top + Height;
    LONG TabWindowLeft = TabWindowRect.left;
    LONG TabWindowTop = TabWindowRect.top;
    ScreenToClient(&TabWindowRect);
    m_TabCtrl.MoveWindow(TabWindowRect);
    //SetListBoxTopLeft(TabWindowRect.top + 5, 10+Width);
    //SetListBoxTopLeft(-1, 10+Width);
    SetListBoxTopLeft(-1, Width);

    LONG Left = MAXLONG, Top = 0;
    for(size_t i = 0 ; i < NumDlg; ++i)
	{
        CRect ItemRect;
        m_TabCtrl.GetItemRect(i, &ItemRect);
        Left = min(Left, ItemRect.left);
        Top = max(Top, ItemRect.bottom);
	}
    //Left += TabWindowLeft + 5;
    //Top += TabWindowTop + 5;
    Left += TabWindowLeft;
    Top += TabWindowTop + 2;
    for(size_t i = 0 ; i < NumDlg; ++i)
    {
        CDialog* pChild = m_TabDlgVec[i].Child;
        CRect ChildRect;
        pChild->GetWindowRect(&ChildRect);
        ChildRect.OffsetRect(Left - ChildRect.left, Top - ChildRect.top);
        ScreenToClient(ChildRect);
        pChild->MoveWindow(ChildRect);
    }

    if(!m_TabDlgVec.empty())
    {
        m_TabCtrl.SetCurSel(m_TabItem);
    }
    else
    {
        //no dialogs
        LogEvent(LE_INFO, "CTraceTabBaseDlg::CreateAndPlaceDialogs() No Dialogs so hide the Tab Control");
        m_TabCtrl.ShowWindow(SW_HIDE);
        SetListBoxTopLeft(-1, 8);
    }

    return TRUE;
}
开发者ID:BlueSpells,项目名称:MapGen,代码行数:76,代码来源:TraceTabBaseDlg.cpp


注:本文中的CDialog::GetWindowRect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。