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

📄 combo.cpp

📁 hen zhongyao de xuexiziliao 稀飯哦
💻 CPP
字号:
// Combo.cpp : implementation file
//

#include "stdafx.h"
#include "Combo.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCombo dialog


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


void CCombo::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCombo)
	DDX_Control(pDX, IDC_PATTERN, m_Pattern);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CCombo, CDialog)
	//{{AFX_MSG_MAP(CCombo)
	ON_CBN_SELCHANGE(IDC_PATTERN, OnSelchangePattern)
	ON_WM_PAINT()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCombo message handlers

void CCombo::OnSelchangePattern() 
{
	// TODO: Add your control notification handler code here
	int nIndex=m_Pattern.GetCurSel();
	if(nIndex!=CB_ERR)
	{
		m_nDrawPattern=m_Pattern.GetItemData(nIndex);
		Invalidate();
	}
}

void CCombo::OnPaint() 
{
	CPaintDC dc(this); // device context for painting
	
	// TODO: Add your message handler code here

	CWnd* pWnd=GetDlgItem(IDC_DRAW);
	pWnd->UpdateWindow();
	CDC* pDC=pWnd->GetDC();
	CBrush drawBrush;
	drawBrush.CreateHatchBrush(m_nDrawPattern,RGB(0,0,0));
	CBrush* pOldBrush=pDC->SelectObject(&drawBrush);
	CRect rcClient;
	pWnd->GetClientRect(rcClient);
	pDC->Rectangle(rcClient);
	pDC->SelectObject(pOldBrush);
	// Do not call CDialog::OnPaint() for painting messages
}

BOOL CCombo::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CString str[6]={"水平线","竖直线","向下斜线","向上斜线","十字线","交叉线"};
	int nIndex;
	for(int i=0;i<6;i++)
	{
		nIndex=m_Pattern.AddString(str[i]);
		m_Pattern.SetItemData(nIndex,i);
	}
	m_Pattern.SetCurSel(0);
	m_nDrawPattern=0;

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

void CCombo::OnOK() 
{
	// TODO: Add extra validation here

	CDialog::OnOK();
}

⌨️ 快捷键说明

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