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

📄 settingproperty.cpp

📁 能够完成画直线
💻 CPP
字号:
// SettingProperty.cpp : implementation file
//

#include "stdafx.h"
#include "DrawPicture.h"
#include "SettingProperty.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSettingProperty dialog


CSettingProperty::CSettingProperty(CWnd* pParent /*=NULL*/)
	: CDialog(CSettingProperty::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSettingProperty)
	m_uLineWidth = 0;
	//}}AFX_DATA_INIT

}


void CSettingProperty::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSettingProperty)
	DDX_Text(pDX, IDC_EDIT2, m_uLineWidth);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSettingProperty, CDialog)
	//{{AFX_MSG_MAP(CSettingProperty)
	ON_BN_CLICKED(IDC_BUTTON1, OnBnClickedSettingColor)
	ON_WM_CTLCOLOR()
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSettingProperty message handlers

BOOL CSettingProperty::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  在此添加额外的初始化
//	((CButton *)GetDlgItem(IDC_BUTTON1))->SetButtonStyle(BS_TEXT ,true);
	m_nLineStyle=((CComboBox *)GetDlgItem(IDC_COMBO1))->SetCurSel(m_nLineStyle);

	return TRUE;  // return TRUE unless you set the focus to a control
	// 异常: OCX 属性页应返回 FALSE
}

HBRUSH CSettingProperty::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
	
	// TODO: Return a different brush if the default is not desired


	return hbr;
}

//设置线的颜色
void CSettingProperty::OnBnClickedSettingColor() 
{
	// TODO: Add your control notification handler code here
	CColorDialog	ColorDlg;

	ColorDlg.m_cc.rgbResult=m_crColor;
	if(IDOK==ColorDlg.DoModal())
	{
		m_crColor=ColorDlg.m_cc.rgbResult;
	}

}

void CSettingProperty::OnOK() 
{
	// TODO: Add extra validation here
	m_nLineStyle=((CComboBox *)GetDlgItem(IDC_COMBO1))->GetCurSel();
	
	CDialog::OnOK();
}

void CSettingProperty::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here
	UpdateData();
	
	// Do not call CDialog::OnPaint() for painting messages
}

⌨️ 快捷键说明

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