gridinto.cpp

来自「lgxgrid控件lgxgrid控件lgxgrid控件lgxgrid控件lgxg」· C++ 代码 · 共 106 行

CPP
106
字号
// GridInto.cpp : implementation file
//

#include "stdafx.h"
#include "LgxgridForMoreDocView.h"
#include "LgxgridForMoreDoc.h"
#include "GridInto.h"


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

/////////////////////////////////////////////////////////////////////////////
// CGridInto dialog


CGridInto::CGridInto(CWnd* pParent /*=NULL*/)
	: CDialog(CGridInto::IDD, pParent)
{
	Lists=8;
	Rows=50;
	Left=20;
	Top=20;
	Onyes=0;
	//{{AFX_DATA_INIT(CGridInto)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT

}


void CGridInto::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Text(pDX,IDC_EDIT1,Lists);
	DDV_MinMaxUInt(pDX,Lists,1,30);
	DDX_Text(pDX,IDC_EDIT2,Rows);
	DDV_MinMaxUInt(pDX,Rows,1,10000);
	DDX_Text(pDX,IDC_EDIT3,Left);
	DDV_MinMaxUInt(pDX,Left,0,500);
	DDX_Text(pDX,IDC_EDIT4,Top);
	DDV_MinMaxUInt(pDX,Top,0,500);

}


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

/////////////////////////////////////////////////////////////////////////////
// CGridInto message handlers
BOOL CGridInto::PreTranslateMessage(MSG* pMsg)//处理对话框的回车消息
{
    if(pMsg->message == WM_KEYDOWN)
    {
		if (pMsg->wParam == VK_ESCAPE)		//Esc键不退出程序
		{
			return TRUE;
		}
		else if(pMsg->wParam == VK_RETURN)
		{
 		    if(pMsg->hwnd==GetDlgItem(IDC_EDIT1)->m_hWnd)
			{
			   GetDlgItem(IDC_EDIT2)->SetFocus();
			}

 		    if(pMsg->hwnd==GetDlgItem(IDC_EDIT2)->m_hWnd)
			{
			   GetDlgItem(IDC_EDIT3)->SetFocus();
			}
 
 		    if(pMsg->hwnd==GetDlgItem(IDC_EDIT3)->m_hWnd)
			{
			   GetDlgItem(IDC_EDIT4)->SetFocus();
			}

 		    if(pMsg->hwnd==GetDlgItem(IDC_EDIT4)->m_hWnd)
			{
			   GetDlgItem(IDOK)->SetFocus();
			}

 		    if(pMsg->hwnd==GetDlgItem(IDOK)->m_hWnd)
			{
			   CGridInto::OnOK();
			}
			return FALSE;
		}
   }

	return CDialog::PreTranslateMessage(pMsg);
}

void CGridInto::OnOK() 
{
	// TODO: Add extra validation here
    UpdateData(TRUE);
	Onyes=1;//标记对话的关闭模式。
	CDialog::OnOK();
}

⌨️ 快捷键说明

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