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

📄 frmcommontitle.cpp

📁 上传的是有关mfc的详细介绍
💻 CPP
字号:
// FrmCommonTitle.cpp: implementation of the FrmCommonTitle class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "FrmCommonTitle.h"
#include "FrmMain.h"
#include "FrmExit.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

IMPLEMENT_REGISTANDPRC(FrmCommonTitle)

FrmCommonTitle::FrmCommonTitle()
{
	this->m_strFile = "FrmCommonTitle.ini";	
	this->m_ClassName = "FrmCommonTitle";
	this->m_WndStruct.nWndType	= 1;
	this->m_WndStruct.style		= WS_CHILD|WS_POPUP|WS_VISIBLE;
}

FrmCommonTitle::~FrmCommonTitle()
{

}

void FrmCommonTitle::MoveWnd()
{
	CBaseDialog::MoveWnd();
	::SetWindowText(this->m_ctrlTitle->m_hWnd, TEXT(this->m_strSearchTitle));
}

void FrmCommonTitle::SetControlPropertity()
{
	CBaseDialog::SetControlPropertity();

	this->m_ctrlHome = this->GetControlByKey("IDC_BTN_COMMON_RETURNHOME");
	this->m_ctrlBack = this->GetControlByKey("IDC_BTN_COMMON_BACK");
	this->m_ctrlTitle = this->GetControlByKey("IDC_BTN_COMMON_TITLE");
	this->m_ctrlExit = this->GetControlByKey("IDC_BTN_COMMON_EXIT");

	// 显示比例:设置显示比例按钮的字体大小及位置
	m_ctrlTitle->m_CProperty.m_logfont.lfWeight	= 700;   // 粗体
	m_ctrlTitle->m_CProperty.m_logfont.lfWidth	+= 12;
	m_ctrlTitle->m_CProperty.m_logfont.lfHeight	+= 16;

	// 设置控件事件
	this->SetCtrlEvent(this->m_ctrlHome, OnHome);
	this->SetCtrlEvent(this->m_ctrlBack, GoBack);
	this->SetCtrlEvent(this->m_ctrlExit, OnExit);
}

void FrmCommonTitle::InitDataBeforeShow()
{
	CBaseDialog::InitDataBeforeShow();

	if (m_parentWnd != NULL)
	{		
		this->m_WndStruct.hwndParent = this->m_parentWnd;

	
		if (this->m_hWnd != NULL && this->m_hWnd > 0)
		{
			::SetParent(this->m_hWnd, this->m_parentWnd);		
		}
	}
}

void FrmCommonTitle::OnHome(WPARAM wParam, LPARAM lParam)
{
	SendMessage(FrmMain::s_FrmMain.m_hWnd, MFC_SHOWWND,0,0);
	this->OnHide();	
	::ShowWindow(this->m_parentWnd, SW_HIDE);
}

void FrmCommonTitle::OnExit(WPARAM wParam, LPARAM lParam)
{
	FrmExit::s_FrmExit.m_hBack = &this->m_parentWnd;
	FrmExit::s_FrmExit.OnShow();
	this->OnHide();		
	::ShowWindow(this->m_parentWnd, SW_HIDE);
}

void FrmCommonTitle::GoBack(WPARAM wParam, LPARAM lParam)
{	
	if (this->m_hBack)
	{
		//this->OnHide();
		::ShowWindow(this->m_parentWnd, SW_HIDE);
		::SendMessage(*this->m_hBack, MFC_SHOWWND, 0, 0);
	}
}

⌨️ 快捷键说明

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