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

📄 canvasthreaddlg.cpp

📁 制作漂亮界面的方便有用的类
💻 CPP
字号:
// CanvasThreadDlg.cpp : implementation file
//

#include "stdafx.h"
#include "CanvasThread.h"
#include "CanvasThreadDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CCanvasThreadDlg dialog

CCanvasThreadDlg::CCanvasThreadDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CCanvasThreadDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CCanvasThreadDlg)
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CCanvasThreadDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CCanvasThreadDlg)
	DDX_Control(pDX, IDC_CANVAS, m_canvas);
	//}}AFX_DATA_MAP
	DDX_Control(pDX, IDC_SUNKEN, flat);
}

BEGIN_MESSAGE_MAP(CCanvasThreadDlg, CDialog)
	//{{AFX_MSG_MAP(CCanvasThreadDlg)
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_WM_NCHITTEST()
	ON_BN_CLICKED(IDC_SUNKEN, OnRadio1)
	ON_BN_CLICKED(IDC_ABOVE, OnRadio2)
	ON_BN_CLICKED(IDC_FLAT, OnRadio3)
	ON_BN_CLICKED(IDC_OTHER, OnRadio4)
	ON_BN_CLICKED(IDC_LOW, OnLow)
	ON_BN_CLICKED(IDC_UP, OnUp)
	ON_BN_CLICKED(IDC_SIMPLE, OnSimple)
	ON_BN_CLICKED(IDC_LIGHT_FRAME, OnLightFrame)
	ON_BN_CLICKED(IDC_THIN_FRAME, OnThinFrame)
	ON_BN_CLICKED(IDC_THIN_LIGHT_FRAME, OnThinLightFrame)
	ON_BN_CLICKED(IDC_ETCHED, OnEtched)
	ON_BN_CLICKED(IDC_ETCHED2, OnEtched2)
	ON_WM_CHAR()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CCanvasThreadDlg message handlers

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

	flat.SetCheck(1);
//	m_canvas.SubclassDlgItem(IDC_CANVAS,this);

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here
	
	return TRUE;  // return TRUE  unless you set the focus to a control
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CCanvasThreadDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CCanvasThreadDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

UINT CCanvasThreadDlg::OnNcHitTest(CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	UINT nHit = CDialog::OnNcHitTest(point);
	if ( nHit == HTCLIENT )
		nHit = HTCAPTION;
	return nHit;
}

void CCanvasThreadDlg::OnRadio1() 
{
	// TODO: Add your control notification handler code here
	
	m_canvas.SetBorder(CTest::SUNKEN);
	m_canvas.Repaint();
}

void CCanvasThreadDlg::OnRadio2() 
{
	// TODO: Add your control notification handler code here
	
	m_canvas.SetBorder(CTest::HIGH);
	m_canvas.Repaint();
}

void CCanvasThreadDlg::OnRadio3() 
{
	// TODO: Add your control notification handler code here
	
	m_canvas.SetBorder(CTest::FLAT);
	m_canvas.Repaint();
}

void CCanvasThreadDlg::OnRadio4() 
{
	// TODO: Add your control notification handler code here
	
	m_canvas.SetBorder(CTest::FRAME);
	m_canvas.Repaint();
}

void CCanvasThreadDlg::OnLow() 
{
	// TODO: Add your control notification handler code here
	
	m_canvas.SetBorder(CTest::LOW);
	m_canvas.Repaint();
}

void CCanvasThreadDlg::OnUp() 
{
	// TODO: Add your control notification handler code here
	
	m_canvas.SetBorder(CTest::UP);
	m_canvas.Repaint();
}

void CCanvasThreadDlg::OnSimple() 
{
	// TODO: Add your control notification handler code here
	
	m_canvas.SetBorder(CTest::SIMPLE);
	m_canvas.Repaint();	
}

void CCanvasThreadDlg::OnLightFrame() 
{
	// TODO: Add your control notification handler code here
	
	m_canvas.SetBorder(CTest::LIGHT_FRAME);
	m_canvas.Repaint();	
}

void CCanvasThreadDlg::OnThinFrame() 
{
	// TODO: Add your control notification handler code here
	
	m_canvas.SetBorder(CTest::THIN_FRAME);
	m_canvas.Repaint();	
}

void CCanvasThreadDlg::OnThinLightFrame() 
{
	// TODO: Add your control notification handler code here
	
	m_canvas.SetBorder(CTest::THIN_LIGHT_FRAME);
	m_canvas.Repaint();
}

void CCanvasThreadDlg::OnEtched() 
{
	// TODO: Add your control notification handler code here
	
	m_canvas.SetBorder(CTest::ETCHED);
	m_canvas.Repaint();	
}

void CCanvasThreadDlg::OnEtched2() 
{
	// TODO: Add your control notification handler code here
	m_canvas.SetBorder(CTest::ETCHED2);
	m_canvas.Repaint();	
}

⌨️ 快捷键说明

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