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

📄 settings.cpp

📁 Client 和Server 配套的网络连接程序。
💻 CPP
字号:
// Settings.cpp : implementation file
//

#include "stdafx.h"
#include "ServerProgram.h"
#include "Settings.h"

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

/////////////////////////////////////////////////////////////////////////////
// Settings dialog


Settings::Settings(CWnd* pParent /*=NULL*/)
	: CDialog(Settings::IDD, pParent)
{
	//{{AFX_DATA_INIT(Settings)
	m_Log = FALSE;
	m_LogFile = _T("");
	m_Password = FALSE;
	m_Port = _T("");
	m_Sound = FALSE;
	m_UserFile = _T("");
	m_Version = FALSE;
	m_VersionNum = _T("");
	m_SystemTray = FALSE;
	m_Maintenance = FALSE;
	m_MaintenanceDays = _T("");
	//}}AFX_DATA_INIT
}


void Settings::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(Settings)
	DDX_Control(pDX, IDC_MAINTENANCEDAYS, m_MaintenanceDaysControl);
	DDX_Control(pDX, IDC_MAINTENANCETEXT, m_MaintenanceText);
	DDX_Control(pDX, IDC_USERFILETEXT, m_UserFileText);
	DDX_Control(pDX, IDC_VERSIONNUM, m_VersionNumControl);
	DDX_Control(pDX, IDC_VERSIONNUMTEXT, m_VersionNumText);
	DDX_Control(pDX, IDC_USERFILE, m_UserFileControl);
	DDX_Control(pDX, IDC_LOGFILE, m_LogFileControl);
	DDX_Control(pDX, IDC_LOGFILETEXT, m_LogFileText);
	DDX_Check(pDX, IDC_LOG, m_Log);
	DDX_Text(pDX, IDC_LOGFILE, m_LogFile);
	DDX_Check(pDX, IDC_PASSWORD, m_Password);
	DDX_Text(pDX, IDC_PORT, m_Port);
	DDX_Check(pDX, IDC_SOUND, m_Sound);
	DDX_Text(pDX, IDC_USERFILE, m_UserFile);
	DDX_Check(pDX, IDC_VERSION, m_Version);
	DDX_Text(pDX, IDC_VERSIONNUM, m_VersionNum);
	DDX_Check(pDX, IDC_SYSTEMTRAY, m_SystemTray);
	DDX_Check(pDX, IDC_MAINTENANCE, m_Maintenance);
	DDX_Text(pDX, IDC_MAINTENANCEDAYS, m_MaintenanceDays);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(Settings, CDialog)
	//{{AFX_MSG_MAP(Settings)
	ON_BN_CLICKED(IDC_LOG, OnLogFile)
	ON_BN_CLICKED(IDC_VERSION, OnVersion)
	ON_BN_CLICKED(IDC_PASSWORD, OnPassword)
	ON_BN_CLICKED(IDC_MAINTENANCE, OnMaintenance)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// Settings message handlers

BOOL Settings::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	if (!m_Log)
	{
		m_LogFileControl.EnableWindow(FALSE);
		m_LogFileText.EnableWindow(FALSE);
	}
	if (!m_Version)
	{
		m_VersionNumControl.EnableWindow(FALSE);
		m_VersionNumText.EnableWindow(FALSE);
	}
	if (!m_Password)
	{
		m_UserFileControl.EnableWindow(FALSE);
		m_UserFileText.EnableWindow(FALSE);
	}
	if (!m_Maintenance)
	{
		m_MaintenanceDaysControl.EnableWindow(FALSE);
		m_MaintenanceText.EnableWindow(FALSE);
	}
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void Settings::OnLogFile() 
{
	UpdateData(TRUE);
	if (m_Log)
	{
		m_LogFileControl.EnableWindow(TRUE);
		m_LogFileText.EnableWindow(TRUE);
	}
	else
	{
		m_LogFileControl.EnableWindow(FALSE);
		m_LogFileText.EnableWindow(FALSE);
	}
}

void Settings::OnVersion() 
{
	UpdateData(TRUE);
	if (m_Version)
	{
		m_VersionNumControl.EnableWindow(TRUE);
		m_VersionNumText.EnableWindow(TRUE);
	}
	else
	{
		m_VersionNumControl.EnableWindow(FALSE);
		m_VersionNumText.EnableWindow(FALSE);
	}
}

void Settings::OnPassword() 
{
	UpdateData(TRUE);
	if (m_Password)
	{
		m_UserFileControl.EnableWindow(TRUE);
		m_UserFileText.EnableWindow(TRUE);
	}
	else
	{
		m_UserFileControl.EnableWindow(FALSE);
		m_UserFileText.EnableWindow(FALSE);
	}
}

void Settings::OnMaintenance() 
{
	UpdateData(TRUE);
	if (m_Maintenance)
	{
		m_MaintenanceDaysControl.EnableWindow(TRUE);
		m_MaintenanceText.EnableWindow(TRUE);
	}
	else
	{
		m_MaintenanceDaysControl.EnableWindow(FALSE);
		m_MaintenanceText.EnableWindow(FALSE);
	}
}

⌨️ 快捷键说明

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