propertydlg.cpp

来自「该程序演示了如何在windows平台下使用WindowsAPI函数来操作串口」· C++ 代码 · 共 87 行

CPP
87
字号
// PropertyDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Terminator.h"
#include "PropertyDlg.h"
#include"MainFrm.h"
#include"TerminatorDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPropertyDlg dialog


CPropertyDlg::CPropertyDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPropertyDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPropertyDlg)

//	m_cEcho.Create(_T("本地回显"),BS_CHECKBOX|WS_CHILD|WS_VISIBLE, 
  // CRect(10,10,100,30), pParent, IDC_ECHO);
	//}}AFX_DATA_INIT
}


void CPropertyDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPropertyDlg)
	DDX_Control(pDX, IDC_NEWLINE, m_cNewLine);
	DDX_Control(pDX, IDC_ECHO, m_cEcho);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPropertyDlg, CDialog)
	//{{AFX_MSG_MAP(CPropertyDlg)
	ON_BN_CLICKED(IDC_NEWLINE, OnNewline)
	ON_BN_CLICKED(IDC_ECHO, OnEcho)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPropertyDlg message handlers

void CPropertyDlg::OnNewline() 
{	m_NewLine=!m_NewLine;
	CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->GetMainWnd();
	CTerminatorDoc* pDoc=(CTerminatorDoc*)pwnd->GetActiveDocument();
	pDoc->m_bNewLine=m_NewLine;
//	if(pDoc->m_bNewLine)AfxMessageBox("new line is valid");
}

void CPropertyDlg::OnEcho() 
{
	m_Echo=!m_Echo;
	CMainFrame* pwnd=(CMainFrame*)AfxGetApp()->GetMainWnd();
	CTerminatorDoc* pDoc=(CTerminatorDoc*)pwnd->GetActiveDocument();
	pDoc->m_bEcho=m_Echo;
//	if(pDoc->m_bEcho)AfxMessageBox("Echo is valid");
}

BOOL CPropertyDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	m_NewLine=FALSE;
	m_Echo=FALSE;
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

int CPropertyDlg::GetCheckState(BOOL flag)
{
/*
if(flag==false)
	return m_cEcho.GetState();
else return m_cNewLine.GetState();
*/
	return 0;
}

⌨️ 快捷键说明

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