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

📄 graphdlg.cpp

📁 mfc例题与练习第二版 例题与练习第二版
💻 CPP
字号:
// GraphDlg.cpp : implementation file
//

#include "stdafx.h"
#include "exp33_1.h"
#include "GraphDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CGraphDlg dialog


CGraphDlg::CGraphDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CGraphDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CGraphDlg)
	m_strEnd = _T("");
	m_intType = -1;
	m_intRed = 0;
	m_intX1 = 0;
	m_intY1 = 0;
	m_intY2 = 0;
	m_intX2 = 0;
	m_intBlue = 0;
	m_intGreen = 0;
	m_strStart = _T("");
	//}}AFX_DATA_INIT
}


void CGraphDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CGraphDlg)
	DDX_Control(pDX, IDC_RED, m_editRed);
	DDX_Control(pDX, IDC_GREEN, m_editGreen);
	DDX_Control(pDX, IDC_BLUE, m_editBlue);
	DDX_Control(pDX, IDC_SPIN3, m_spinBlue);
	DDX_Control(pDX, IDC_SPIN2, m_spinGreen);
	DDX_Control(pDX, IDC_SPIN1, m_spinRed);
	DDX_Text(pDX, IDC_END, m_strEnd);
	DDX_Radio(pDX, IDC_LINE, m_intType);
	DDX_Text(pDX, IDC_RED, m_intRed);
	DDV_MinMaxInt(pDX, m_intRed, 0, 255);
	DDX_Text(pDX, IDC_X1, m_intX1);
	DDX_Text(pDX, IDC_Y1, m_intY1);
	DDX_Text(pDX, IDC_Y2, m_intY2);
	DDX_Text(pDX, IDC_X2, m_intX2);
	DDX_Text(pDX, IDC_BLUE, m_intBlue);
	DDV_MinMaxInt(pDX, m_intBlue, 0, 255);
	DDX_Text(pDX, IDC_GREEN, m_intGreen);
	DDV_MinMaxInt(pDX, m_intGreen, 0, 255);
	DDX_Text(pDX, IDC_START, m_strStart);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CGraphDlg, CDialog)
	//{{AFX_MSG_MAP(CGraphDlg)
	ON_BN_CLICKED(IDC_LINE, OnRadioLine)
	ON_BN_CLICKED(IDC_CIRCLE, OnRadioCircle)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGraphDlg message handlers

BOOL CGraphDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	m_spinBlue.SetBuddy(&m_editBlue);
	m_spinBlue.SetRange(0,255);
	m_spinBlue.SetBase(1);
	m_spinGreen.SetBuddy(&m_editGreen);
	m_spinGreen.SetRange(0,255);
	m_spinGreen.SetBase(1);
	m_spinRed.SetBuddy(&m_editRed);
	m_spinRed.SetRange(0,255);
	m_spinRed.SetBase(1);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CGraphDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData(TRUE); 

	CDialog::OnOK();
}

void CGraphDlg::OnRadioLine() 
{
	// TODO: Add your control notification handler code here
	m_intType = 0;
	GetDlgItem(IDC_Y2)->EnableWindow(TRUE);
	GetDlgItem(IDC_STATIC_Y2)->EnableWindow(TRUE);
	GetDlgItem(IDC_STATIC_X2)->EnableWindow(TRUE);
	m_strEnd = "终点";
	m_strStart = "起点";
	UpdateData(FALSE);
}

void CGraphDlg::OnRadioCircle() 
{
	// TODO: Add your control notification handler code here
	m_intType = 1;
	GetDlgItem(IDC_Y2)->EnableWindow(FALSE);
	GetDlgItem(IDC_STATIC_Y2)->EnableWindow(FALSE);
	GetDlgItem(IDC_STATIC_X2)->EnableWindow(FALSE);
	m_strEnd = "半径";
	
	m_strStart = "圆心";
	UpdateData(FALSE);
}

⌨️ 快捷键说明

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