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

📄 setdlg.cpp

📁 能够很好的画各种图形
💻 CPP
字号:
// SetDlg.cpp : implementation file
//

#include "stdafx.h"
#include "sam绘图.h"
#include "SetDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CSetDlg dialog


CSetDlg::CSetDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSetDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSetDlg)
	m_Bcolor = _T("");
	m_Pcolor = _T("");
	m_Pstyle = -1;
	m_Bstyle = -1;
	m_Dstyle = -1;
	//}}AFX_DATA_INIT
}


void CSetDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSetDlg)
	DDX_Control(pDX, IDC_BUTTON3, m_Btn2);
	DDX_Control(pDX, IDC_BUTTON2, m_Btn1);
	DDX_CBString(pDX, IDC_Bcolor, m_Bcolor);
	DDX_CBString(pDX, IDC_Pcolor, m_Pcolor);
	DDX_Radio(pDX, IDC_Solid, m_Pstyle);
	DDX_Radio(pDX, IDC_SolidBrush, m_Bstyle);
	DDX_LBIndex(pDX, IDC_Dstyle, m_Dstyle);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSetDlg, CDialog)
	//{{AFX_MSG_MAP(CSetDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSetDlg message handlers

BOOL CSetDlg::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext) 
{
	// TODO: Add your specialized code here and/or call the base class
	((CComboBox*)GetDlgItem(IDC_Pcolor))->AddString("Red");
	
	return CDialog::Create(IDD, pParentWnd);
}

BOOL CSetDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	((CListBox*)GetDlgItem(IDC_Dstyle))->AddString("Line");
	((CListBox*)GetDlgItem(IDC_Dstyle))->AddString("Circle");
	((CListBox*)GetDlgItem(IDC_Dstyle))->AddString("Rectangle");
	((CListBox*)GetDlgItem(IDC_Dstyle))->AddString("RoundRectangle");
	((CListBox*)GetDlgItem(IDC_Dstyle))->SetCurSel(0);




	((CComboBox*)GetDlgItem(IDC_Pcolor))->AddString("Red");
	((CComboBox*)GetDlgItem(IDC_Pcolor))->AddString("Green");
    ((CComboBox*)GetDlgItem(IDC_Pcolor))->AddString("Blue");
	//((CComboBox*)GetDlgItem(IDC_Pcolor))->AddString("自定义");

	((CComboBox*)GetDlgItem(IDC_Pcolor))->SetCurSel(0);


	((CComboBox*)GetDlgItem(IDC_Bcolor))->AddString("Red");
	((CComboBox*)GetDlgItem(IDC_Bcolor))->AddString("Green");
    ((CComboBox*)GetDlgItem(IDC_Bcolor))->AddString("Blue");
	((CComboBox*)GetDlgItem(IDC_Bcolor))->AddString("自定义");

	((CComboBox*)GetDlgItem(IDC_Bcolor))->SetCurSel(0);


	m_Btn1.m_Pbtn=&m_Btn2;
	m_Btn2.m_Pbtn=&m_Btn1;

	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CSetDlg::OnOK() 
{
	// TODO: Add extra validation here
	UpdateData();
	if(m_Pstyle==-1) 
	{
		MessageBox("请选择线型!",NULL,MB_OK);
	}
	else if(m_Bstyle==-1)
	{
		MessageBox("请选择填充类型!",NULL,MB_OK);
	}
	else
	{
		CDialog::OnOK();		
	}
}

⌨️ 快捷键说明

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