Can you use a CMFCVisualManager with a dialog box?

Can you use CMFCVisualManager with a dialog application to change the appearance of applications? If so, how is this done?

The idea is to change shape, color, etc. Controls such as buttons using the MFC Feature Pack released with MSVC 2008.

+4
source share
4 answers

No, it cannot be done, at least not if you are talking about the Feature Pack version. Version 10 of the BCGSoft libraries has this functionality, for example: http://www.bcgsoft.com/bcgcontrolbarpro-versions.htm and http://www.bcgsoft.com/images/SkinnedBuiltInDlgs.jpg . The MFC package of functions is a more or less previous version of BCGSoft libraries, MS bought a license from them.

+2
source

You need to add the Common Controls manifest to the project resources. Here is the manifest file code:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="Program Name" type="win32" /> <description>Description of Program</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> </assembly> 
0
source

I think you can use some of the features of MFC-feature-pack by implementing OnApplicationLook on your CDialog base (check out Step 4 on this page ). It might be better to implement the entire OnApplicationLook method, but you can test your application by simply adding it to OnInitDialog :

 CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007_Silver); CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerOffice2007)); CDockingManager::SetDockingMode(DT_SMART); RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW | RDW_FRAME | RDW_ERASE); 
0
source

This is the least code to include visual styles. You should easily insert your CDialog into the frame. IDR_MAINFRAME is a menu resource.

 class CMFCApplication2Dlg : public CFrameWndEx { CMFCMenuBar bar; public: CMFCApplication2Dlg() : CFrameWndEx() { LoadFrame(IDR_MAINFRAME); bar.Create(this); } }; class CMFCApplication2App : public CWinAppEx { public: virtual BOOL InitInstance() { CWinAppEx::InitInstance(); CMFCVisualManagerOffice2007::SetStyle( CMFCVisualManagerOffice2007::Office2007_ObsidianBlack); CMFCVisualManager::SetDefaultManager( RUNTIME_CLASS(CMFCVisualManagerOffice2007)); SetRegistryKey(_T("Local AppWizard-Generated Applications")); m_pMainWnd = new CMFCApplication2Dlg(); m_pMainWnd->ShowWindow(SW_SHOW); m_pMainWnd->UpdateWindow(); return TRUE; } }; CMFCApplication2App theApp; 
0
source

Source: https://habr.com/ru/post/1276750/


All Articles