⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mlog.cpp

📁 vc做的换皮肤例子
💻 CPP
字号:
// MLog.cpp : Defines the class behaviors for the application.
//

#include "stdafx.h"
#include "MLog.h"

#include "MainFrm.h"
#include "MLogDoc.h"
#include "MLogView.h"
#include "ImageStyle.h"
#include "FunnyStyle.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMLogApp

BEGIN_MESSAGE_MAP(CMLogApp, CWinApp)
	//{{AFX_MSG_MAP(CMLogApp)
	ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
	// Standard file based document commands
	ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
	ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
	// Standard print setup command
	ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMLogApp construction

CMLogApp::CMLogApp()
{
	// TODO: add construction code here,
	// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CMLogApp object

CMLogApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CMLogApp initialization

BOOL CMLogApp::InitInstance()
{
	AfxEnableControlContainer();

	// Standard initialization
	// If you are not using these features and wish to reduce the size
	//  of your final executable, you should remove from the following
	//  the specific initialization routines you do not need.

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	// Change the registry key under which our settings are stored.
	// TODO: You should modify this string to be something appropriate
	// such as the name of your company or organization.
	SetRegistryKey(_T("BCGP AppWizard-Generated Applications"));

	LoadStdProfileSettings();  // Load standard INI file options (including MRU)
	SetRegistryBase (_T("Settings"));
	InitContextMenuManager();
	InitKeyboardManager();
	
	InitSkinManager ();
	GetSkinManager ()->EnableSkinsDownload (_T("http://www.bcgsoft.com/Skins"));
	
	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CMLogDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CMLogView));
	AddDocTemplate(pDocTemplate);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	// Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;

	LoadCustomState ();
	// The one and only window has been initialized, so show and update it.
	m_pMainWnd->ShowWindow(SW_SHOW);
	m_pMainWnd->UpdateWindow();

	return TRUE;
}


/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About

class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
		// No message handlers
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

// App command to run the dialog
void CMLogApp::OnAppAbout()
{
	CAboutDlg aboutDlg;
	aboutDlg.DoModal();
}

/////////////////////////////////////////////////////////////////////////////
// CMLogApp message handlers
void CMLogApp::PreLoadState ()
{
	CImageStyle::m_strImagePath = GetString (_T("ImagePath"), _T(""));
	CImageStyle::m_bIsInternalImage = GetInt (_T("InternalImageBright"), TRUE);
	CImageStyle::m_nHighlight = GetInt (_T("ImageBright"), 100);
	CImageStyle::m_clrText = GetInt (_T("TextColor"), globalData.clrBtnText);
	
	SetSkin (GetInt (_T("SelectedSkin"), ID_LOOK_IMAGE));
}

void CMLogApp::SetSkin (UINT nSkin)
{
	m_uiCurrSkin = nSkin;
	
	if (CBCGPVisualManager::GetInstance () != NULL)
	{
		delete CBCGPVisualManager::GetInstance ();
	}
	
	switch (nSkin)
	{
	case ID_LOOK_2000:
		CBCGPVisualManager::SetDefaultManager (NULL);
		break;
		
	case ID_LOOK_XP:
		CBCGPVisualManager::SetDefaultManager (RUNTIME_CLASS (CBCGPVisualManagerXP));
		break;
		
	case ID_LOOK_WIN_XP:
		if (!CBCGPWinXPVisualManager::IsWinXPThemeAvailible ())
		{
			AfxMessageBox (_T("This skin can be viewed under Windows(r) XP themes only. Because your system doesn't support Windows (r) XP theme, you'll see an Office XP look"));
		}
		
		CBCGPVisualManager::SetDefaultManager (RUNTIME_CLASS (CBCGPWinXPVisualManager));
		break;
		
	case ID_LOOK_2003:
		CBCGPVisualManager::SetDefaultManager (RUNTIME_CLASS (CBCGPVisualManager2003));
		break;
		
	case ID_LOOK_MAC:
		//		new CMacStyle ();
		break;
		
	case ID_LOOK_EXOTIC:
		new CFunnyStyle ();
		break;
		
	case ID_LOOK_IMAGE:
				new CImageStyle ();
		break;
	}
	
	CBCGPVisualManager::GetInstance ()->SetLook2000 ();
	CBCGPVisualManager::GetInstance ()->RedrawAll ();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -