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

📄 multidiffquaddistdlg.cpp

📁 数据结构链表的演示程序
💻 CPP
字号:
// MultiDiffQuadDistDlg.cpp : implementation file
//

#include "stdafx.h"
#include "LandSoft.h"
#include "MultiDiffQuadDistDlg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CMultiDiffQuadDistDlg dialog


CMultiDiffQuadDistDlg::CMultiDiffQuadDistDlg(CWnd* pParent,UINT maxlong,UINT boxlong,
											 CString oldstring,UINT oldrange)
	: CDialog(CMultiDiffQuadDistDlg::IDD, pParent)
{
	m_nMaxlong=maxlong;
	m_nBoxlong=boxlong;

	//{{AFX_DATA_INIT(CMultiDiffQuadDistDlg)
	m_Boxleng = oldstring;
	m_nRange = oldrange;
	//}}AFX_DATA_INIT
}


void CMultiDiffQuadDistDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMultiDiffQuadDistDlg)
	DDX_Text(pDX, IDC_EDIT_BOXLENG, m_Boxleng);
	DDX_Text(pDX, IDC_EDIT_RANGE, m_nRange);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CMultiDiffQuadDistDlg, CDialog)
	//{{AFX_MSG_MAP(CMultiDiffQuadDistDlg)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMultiDiffQuadDistDlg message handlers

void CMultiDiffQuadDistDlg::OnOK() 
{
	UpdateData(TRUE);
	m_Boxleng.TrimLeft();
	CString tmpstr="";
	UINT tmpleng;
	UINT prevleng=0;
	char tmp;
	m_Lengs.RemoveAll();
	for(int i=0;i<m_Boxleng.GetLength();i++)
	{
		tmp=m_Boxleng.GetAt(i);
		
		if(tmp>47&&tmp<58)
		{
			tmpstr+=tmp;
				continue;
		}

		else if(tmp==32)
		{
			if(m_Boxleng.GetAt(i-1)!=32)
			{
				tmpleng=atoi(tmpstr);
				
				if(tmpleng<1||tmpleng>m_nMaxlong)
				{
					AfxMessageBox("你输入的值必须大于0,小于图像长度。",MB_OK,NULL);
					return;
				}

				if(tmpleng<=prevleng)
				{
					AfxMessageBox("你应当从小到大输入, 且不能相等!",MB_OK,NULL);
					return;
				}

				prevleng=tmpleng;
				m_Lengs.Add(tmpleng);
				tmpstr="";
			}

			continue;
		}

		else
		{
			AfxMessageBox("你输入了非法字符,请重新输入!",MB_OK,NULL);
			return;
		}
	}
	
	if(tmp>47&&tmp<58)
	{
		tmpleng=atoi(tmpstr);

		if(tmpleng<1||tmpleng>m_nMaxlong)
		{
			AfxMessageBox("你输入的值必须大于0,小于图像长度。",MB_OK,NULL);
			return;
		}

		if(tmpleng<=prevleng)
		{
			AfxMessageBox("你应当从小到大输入, 且不能相等!",MB_OK,NULL);
				return;
		}
		
		m_Lengs.Add(tmpleng);
	}

	if(m_Lengs[0]<m_nRange||(m_Lengs[0]+m_nRange)<m_nBoxlong||
		(m_Lengs[m_Lengs.GetSize()-1]-m_nRange)>m_nMaxlong)
	{
		AfxMessageBox("范围越界,请重新输入!",MB_OK,NULL);
		return;
	}

	CDialog::OnOK();
}

⌨️ 快捷键说明

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