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

📄 dlgnonmodal.cpp

📁 dialongtest1 是一个简单的程序
💻 CPP
字号:
// DlgNonModal.cpp : implementation file
//

#include "stdafx.h"
#include "DialogTest1.h"
#include "DlgNonModal.h"

#include "DialogTest1View.h"
#include "ChildFrm.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDlgNonModal dialog


CDlgNonModal::CDlgNonModal(CWnd* pParent /*=NULL*/)
	: CDialog(CDlgNonModal::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDlgNonModal)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CDlgNonModal::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDlgNonModal)
	DDX_Control(pDX, IDC_SLIDER_BLUE, m_SliderBlue);
	DDX_Control(pDX, IDC_SLIDER_GREEN, m_SliderGreen);
	DDX_Control(pDX, IDC_SLIDER_RED, m_SliderRed);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDlgNonModal, CDialog)
	//{{AFX_MSG_MAP(CDlgNonModal)
	ON_WM_HSCROLL()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDlgNonModal message handlers

void CDlgNonModal::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar *pScrollBar)
{
	CDialogTest1View *pView =(CDialogTest1View*)m_View;
	
	pView->setColor(
		this->m_SliderRed.GetPos(),
		this->m_SliderGreen.GetPos(),
		this->m_SliderBlue.GetPos()
	);
	((CDialogTest1View*)m_View)->Invalidate();
	CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}

void CDlgNonModal::InitColors(int r, int g, int b)
{
	this->m_SliderRed.SetPos(r);
	this->m_SliderGreen.SetPos(g);
	this->m_SliderBlue.SetPos(b);
}

void CDlgNonModal::InitSliders()
{
	this->m_SliderRed.SetRange(0,255);
	this->m_SliderGreen.SetRange(0,255);
	this->m_SliderBlue.SetRange(0,255);
}

void CDlgNonModal::SetView(CWnd *v)
{
	m_View = v;
}

//void CDlgNonModal::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) 
//{
	// TODO: Add your message handler code here and/or call default
	
//	CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
//}

⌨️ 快捷键说明

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