CMFCPropertySheet
函数的class class:函数:
OnInitDialog
i已检查了MFC源,变量
BOOL CDarkModeMFCPropertySheet::OnInitDialog()
{
BOOL bResult = CMFCPropertySheet::OnInitDialog();
if (IsUsingDarkMode())
{
DarkModeTools::EnableDarkModeForDialog(this);
// Customize tab colors for dark mode
m_wndTab.SetActiveTabColor(RGB(0, 120, 212)); // Active tab background (blue)
m_wndTab.SetTabBkColor(RGB(32, 32, 32)); // Inactive tab background (dark gray)
m_wndTab.SetTabTextColor(RGB(200, 200, 200)); // Inactive tab text (light gray)
m_wndTab.SetActiveTabTextColor(RGB(255, 255, 255)); // Active tab text (white)
// m_wndTab.SetTabBorderColor(RGB(64, 64, 64)); // Tab border (darker gray)
}
return bResult;
}
定义为:
m_wndTab
CMFCPropertySheetTabCtrl m_wndTab;
具有我尝试使用的所有功能,并且从文档中表示我应该能够为选项卡控件着色。但是,las,它行不通。为什么?update
CMFCPropertySheetTabCtrl
m_bFlat
现在,当我跟踪该电话时,它确实可以:m_wndTab.ModifyTabStyle(CMFCTabCtrl::STYLE_FLAT);
因此,它确实更改了
BOOL CMFCTabCtrl::ModifyTabStyle(Style style)
{
ASSERT_VALID(this);
m_bFlat = (style == STYLE_FLAT);
m_bIsOneNoteStyle = (style == STYLE_3D_ONENOTE);
m_bIsVS2005Style = (style == STYLE_3D_VS2005);
m_bHighLightTabs = m_bIsOneNoteStyle;
m_bLeftRightRounded = (style == STYLE_3D_ROUNDED || style == STYLE_3D_ROUNDED_SCROLL);
SetScrollButtons();
SetTabsHeight();
return TRUE;
}
变量,我确认它现在为m_bFlat
。但是,尽管调用了此代码,但我的财产表颜色没有任何更改。
我最终使用
TRUE
,至于财产表上的前景栏,我做到了:
TabCtrl
我在
#pragma once
#include <afxvisualmanagerwindows.h>
// CDarkModeMFCVisualManagerWindows command target
class CDarkModeMFCVisualManagerWindows : public CMFCVisualManagerWindows
{
DECLARE_DYNCREATE(CDarkModeMFCVisualManagerWindows)
public:
void OnFillBarBackground(CDC* pDC, CBasePane* pBar, CRect rectClient, CRect rectClip, BOOL bNCArea = FALSE) override
{
if (DarkModeTools::InvokeUseDarkModeFunction())
{
pDC->FillSolidRect(rectClient, DarkModeTools::kDarkControlBackgroundColor);
return;
}
__super::OnFillBarBackground(pDC,pBar,rectClient,rectClip,bNCArea);
}
};
IMPLEMENT_DYNCREATE(CDarkModeMFCVisualManagerWindows, CMFCVisualManagerWindows)
中使用该经理。现在,Outlook栏是我想要的:
,这不是我问题的直接答案,而是令人满意的解决方法。