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

📄 lowpass.cpp

📁 图像处理软件,功能比较基础
💻 CPP
字号:
// LowPass.cpp : implementation file
//

#include "stdafx.h"
#include "linjunjuan.h"
#include "LowPass.h"

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


/////////////////////////////////////////////////////////////////////////////
// LowPass dialog


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


void LowPass::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(LowPass)
	DDX_Control(pDX, IDC_EDIT, m_cEdit);
	DDX_Control(pDX, IDC_SPIN, m_cSpin);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(LowPass, CDialog)
	//{{AFX_MSG_MAP(LowPass)
	ON_NOTIFY(UDN_DELTAPOS, IDC_SPIN, OnDeltaposSpin)
	ON_WM_PAINT()
	ON_WM_VSCROLL()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// LowPass message handlers







BOOL LowPass::OnInitDialog() 
{
	CDialog::OnInitDialog();
	m_cSpin.SetBuddy(&m_cEdit);
	m_cSpin.SetBase(1);
//	m_cSpin.SetRange(0,99);
	m_cSpin.SetPos(0);
	rect1.bottom=rect1.left=rect1.right=rect1.top=0;

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

void LowPass::OnDeltaposSpin(NMHDR* pNMHDR, LRESULT* pResult) 
{
	NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;    
	*pResult = 0;

	m_radius=m_cSpin.GetPos();
	rect1.left=point.x-m_radius/2;
	rect1.top=point.y+m_radius/2;
	rect1.right=point.x+m_radius/2;
	rect1.bottom=point.y-m_radius/2;
	Invalidate();
}

void LowPass::OnPaint() 
{
	RECT rect;
	
	CPaintDC dc(this); // device context for painting
	
	CWnd* pwnd =GetDlgItem(IDC_BLACK);
	CDC *pControlDC =pwnd->GetDC();	
	pwnd->GetClientRect(&rect);
	point.x=(rect.right-rect.left)/2;
	point.y=(rect.bottom-rect.top)/2;
	pwnd->Invalidate();
	pwnd->UpdateWindow();
	if (flagNo==0)
	{
		pControlDC->SelectStockObject(WHITE_BRUSH);
		pControlDC->Rectangle(&rect);	
		pControlDC->SelectStockObject(BLACK_BRUSH);
		pControlDC->RoundRect(&rect1,point);
	}
	if (flagNo==1)
	{
		pControlDC->SelectStockObject(BLACK_BRUSH);
		pControlDC->Rectangle(&rect);	
		pControlDC->SelectStockObject(WHITE_BRUSH);
		pControlDC->RoundRect(&rect1,point);
	}

	pwnd->ReleaseDC(pControlDC);
	
	
	// Do not call CDialog::OnPaint() for painting messages
}

void LowPass::OnOK() 
{
	UpdateData(FALSE);
	m_radius=m_cSpin.GetPos();
	CDialog::OnOK();
}

⌨️ 快捷键说明

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