如何获取 CPropertySheet 对象的可见客户端矩形?

How to get the visible client rect of a CPropertySheet object?

我正在尝试更改 MFC CPropertySheet 对象的某些颜色。我能够更改我想要的所有区域的颜色。但是,还有一个区域是我无法控制的。这是我的代码得到的图像。

如您所见,我可以使用下面的代码在顶部和左边距上绘制一个细边框。

void CEasyPropertySheet::Draw_Borders(CDC* pDC)
{
    // I check how many lines of tabs the control has.
    CTabCtrl* pTab = this->GetTabControl();
    int lines = pTab->GetRowCount();

    // I get the rect I want to define the borders of the control.
    CRect rect; this->GetClientRect(rect);
    pDC->FillSolidRect(rect, GENERIC_BACKGROUND_COLOR);

    // I draw the border in 2 steps. First of all I fill one rect with the border color.
    // After that, I deflect the rect and I filled again using the background color I want.
    rect.DeflateRect(0, 19 * lines, 0, 0);  
    pDC->FillSolidRect(rect, GENERIC_BORDER_COLOR);
    rect.DeflateRect(1, 1);
    pDC->FillSolidRect(rect, PROPERTYPAGE_BACKGROUND_COLOR);
}

但是,我无法使用相同的方法绘制其他(底部和右侧边框)。我认为我使用的矩形比屏幕上显示的要大,但我不知道如何获得该矩形。

有人知道该怎么做吗?

嗯。在尝试了几件事(包括没有意义的事情)之后,我终于找到了我正在寻找的答案。我所要做的就是得到一个不同的矩形。这是有效的代码:

void CEasyPropertySheet::Draw_Borders(CDC* pDC)
{
    // I check how many lines of tabs has the controls.
    CTabCtrl* pTab = this->GetTabControl();
    int lines = pTab->GetRowCount();

    // I get the rect I want to define the borders of the control.
    CRect rect;
    pTab->GetClientRect(rect);
    pDC->FillSolidRect(rect, GENERIC_BACKGROUND_COLOR);

    // I draw the border in 2 steps. First of all I fill one rect with the border color.
    // After that, I deflect the rect and I filled again using the background color I want.
    rect.DeflateRect(0, 19 * lines, 0, 0);
    pDC->FillSolidRect(rect, GENERIC_BORDER_COLOR);
    rect.DeflateRect(1, 1);
    pDC->FillSolidRect(rect, PROPERTYPAGE_BACKGROUND_COLOR);
}

我得到的是整个 CPropertySheet 的矩形,那是个错误。我要做的是获取 CTabCtrl 的矩形。这是结果: