lineproperties.cpp

来自「此源程序是一个简单的绘图程序,你通过他可以画一些简单的图形,是一款简单的画图程序」· C++ 代码 · 共 75 行

CPP
75
字号
// LineProperties.cpp : implementation file
//

#include "stdafx.h"
#include "MyDraw.h"
#include "LineProperties.h"

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

/////////////////////////////////////////////////////////////////////////////
// CLineProperties dialog


CLineProperties::CLineProperties(CWnd* pParent /*=NULL*/)
	: CDialog(CLineProperties::IDD, pParent)
{
	//{{AFX_DATA_INIT(CLineProperties)
	m_LineWidth = _T("");
	m_LineStyle = _T("");
	//}}AFX_DATA_INIT
}


void CLineProperties::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CLineProperties)
	DDX_Control(pDX, IDC_BUTTON_COLOR, m_BtnColor);
	DDX_CBString(pDX, IDC_LINEWIDTH, m_LineWidth);
	DDX_CBString(pDX, IDC_LINESTYLE, m_LineStyle);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CLineProperties, CDialog)
	//{{AFX_MSG_MAP(CLineProperties)
	ON_BN_CLICKED(IDC_BUTTON_COLOR, OnButtonColor)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CLineProperties message handlers


BOOL CLineProperties::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CString str_RGB;
	str_RGB.Format("%d:%d:%d",GetRValue(m_LineColor),
		GetGValue(m_LineColor),GetBValue(m_LineColor));
	this->m_BtnColor.SetWindowText(str_RGB);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CLineProperties::OnButtonColor() 
{
	// TODO: Add your control notification handler code here
	CColorDialog dlg(m_LineColor); 
	if (dlg.DoModal()==IDOK)
	{
		m_LineColor=dlg.GetColor();
		CString str_RGB;
		str_RGB.Format("%d:%d:%d",GetRValue(m_LineColor),
			GetGValue(m_LineColor),GetBValue(m_LineColor));
		this->m_BtnColor.SetWindowText(str_RGB);
	}
}

⌨️ 快捷键说明

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