这个是VC的源代码

源代码在线查看: mask.cpp

软件大小: 401 K
上传用户: baorong216
关键词: 源代码
下载地址: 免注册下载 普通下载 VIP

相关代码

				// Mask.cpp : implementation file
				//
				
				#include "stdafx.h"
				#include "ImagePro.h"
				#include "Mask.h"
				
				#ifdef _DEBUG
				#define new DEBUG_NEW
				#undef THIS_FILE
				static char THIS_FILE[] = __FILE__;
				#endif
				
				/////////////////////////////////////////////////////////////////////////////
				// Mask dialog
				
				
				Mask::Mask(CWnd* pParent /*=NULL*/)
					: CDialog(Mask::IDD, pParent)
				{
				
					mask= new int[5*5];
					//{{AFX_DATA_INIT(Mask)
					m_width = 0;
					m_coef = 0.0f;
					m_11 = 0;
					m_12 = 0;
					m_13 = 0;
					m_14 = 0;
					m_15 = 0;
					m_21 = 0;
					m_22 = 0;
					m_23 = 0;
					m_24 = 0;
					m_25 = 0;
					m_31 = 0;
					m_32 = 0;
					m_33 = 0;
					m_34 = 0;
					m_35 = 0;
					m_41 = 0;
					m_42 = 0;
					m_43 = 0;
					m_44 = 0;
					m_45 = 0;
					m_51 = 0;
					m_52 = 0;
					m_53 = 0;
					m_54 = 0;
					m_55 = 0;
					//}}AFX_DATA_INIT
				
					
				}
				
				
				void Mask::DoDataExchange(CDataExchange* pDX)
				{
					CDialog::DoDataExchange(pDX);
					//{{AFX_DATA_MAP(Mask)
				//	DDX_Text(pDX, IDC_EDIT1, m_width);
				//	DDV_MinMaxInt(pDX, m_width, 3, 5);
					DDX_Text(pDX, IDC_EDIT2, m_coef);
					DDX_Text(pDX, IDC_EDIT7, m_11);
					DDX_Text(pDX, IDC_EDIT8, m_12);
					DDX_Text(pDX, IDC_EDIT9, m_13);
					DDX_Text(pDX, IDC_EDIT10, m_14);
					DDX_Text(pDX, IDC_EDIT11, m_15);
					DDX_Text(pDX, IDC_EDIT12, m_21);
					DDX_Text(pDX, IDC_EDIT13, m_22);
					DDX_Text(pDX, IDC_EDIT14, m_23);
					DDX_Text(pDX, IDC_EDIT15, m_24);
					DDX_Text(pDX, IDC_EDIT16, m_25);
					DDX_Text(pDX, IDC_EDIT17, m_31);
					DDX_Text(pDX, IDC_EDIT18, m_32);
					DDX_Text(pDX, IDC_EDIT19, m_33);
					DDX_Text(pDX, IDC_EDIT20, m_34);
					DDX_Text(pDX, IDC_EDIT21, m_35);
					DDX_Text(pDX, IDC_EDIT22, m_41);
					DDX_Text(pDX, IDC_EDIT23, m_42);
					DDX_Text(pDX, IDC_EDIT24, m_43);
					DDX_Text(pDX, IDC_EDIT25, m_44);
					DDX_Text(pDX, IDC_EDIT26, m_45);
					DDX_Text(pDX, IDC_EDIT27, m_51);
					DDX_Text(pDX, IDC_EDIT28, m_52);
					DDX_Text(pDX, IDC_EDIT29, m_53);
					DDX_Text(pDX, IDC_EDIT30, m_54);
					DDX_Text(pDX, IDC_EDIT31, m_55);
					//}}AFX_DATA_MAP
				}
				
				
				BEGIN_MESSAGE_MAP(Mask, CDialog)
					//{{AFX_MSG_MAP(Mask)
					ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
					ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
					//}}AFX_MSG_MAP
				END_MESSAGE_MAP()
				
				/////////////////////////////////////////////////////////////////////////////
				// Mask message handlers
				
				BOOL Mask::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
					
					return CDialog::Create(IDD, pParentWnd);
				}
				
				void Mask::OnOK() 
				{
					// TODO: Add extra validation here
					UpdateData(TRUE);
				
					if(m_width!=3 && m_width!=5)
					{
						AfxMessageBox("请选择模板大小");
						return;
					}
					if(m_coef==0)
					{
				
						AfxMessageBox("请输入模板系数");
						return;
					}
				
					int i,k,m;
					if(m_width==3)
					{
						k=0;
						m=0;
						for(i=IDC_EDIT7;i						{
							CString str;
							GetDlgItem(i)->GetWindowText(str);
							int t=atoi(str);
							int x=k%5;
							int y=k/5;
							if(x							{	
								mask[m]=t;
								m++;
							}
							k++;
						}
					}
					if(m_width==5)
					{
						k=0;
						for(i=IDC_EDIT7;i						{
							CString str;
							GetDlgItem(i)->GetWindowText(str);
							int t=atoi(str);
							int x=k%5;
							int y=k/5;
							mask[y*5+x]=t;
							k++;
						}
					}
				
				
				
				
					
					CDialog::OnOK();
				}
				
				void Mask::OnRadio1() 
				{
					// TODO: Add your control notification handler code here
					int i,k=0;
					m_width=3;
					for(i=IDC_EDIT7;i					{
						
						int x=k%5;
						int y=k/5;
						if(x							(CEdit *) GetDlgItem(i)->EnableWindow(TRUE);
						else
							(CEdit *) GetDlgItem(i)->EnableWindow(FALSE);
				
						k++;
					}
					
				}
				
				void Mask::OnRadio2() 
				{
					// TODO: Add your control notification handler code here
					int i;
					m_width=5;
					for(i=IDC_EDIT7;i					{
						(CEdit *) GetDlgItem(i)->EnableWindow(TRUE);
				
					}
					
				}
				
				void Mask::OnCancel() 
				{
					// TODO: Add extra cleanup here
					
					CDialog::OnCancel();
				}
							

相关资源