gotodalg.cpp

来自「微型文本编辑器. 多文档界面」· C++ 代码 · 共 94 行

CPP
94
字号
// GotoDalg.cpp : implementation file
//

#include "stdafx.h"
#include "Wediter.h"
#include "GotoDalg.h"

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

/////////////////////////////////////////////////////////////////////////////
// CGotoDalg dialog


CGotoDalg::CGotoDalg(CWnd* pParent /*=NULL*/)
	: CDialog(CGotoDalg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CGotoDalg)
	m_gotonumber = 1;
	//}}AFX_DATA_INIT
}


void CGotoDalg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CGotoDalg)
	DDX_Text(pDX, IDC_GOTOEDIT, m_gotonumber);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CGotoDalg, CDialog)
	//{{AFX_MSG_MAP(CGotoDalg)
	ON_WM_DESTROY()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGotoDalg message handlers

BOOL CGotoDalg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CenterWindow();
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CGotoDalg::OnDestroy() 
{
	CDialog::OnDestroy();
	
	// TODO: Add your message handler code here
	delete this;
}

void CGotoDalg::OnCancel() 
{
	// TODO: Add extra cleanup here
	
	CDialog::OnCancel();
	CDialog::DestroyWindow();
}

void CGotoDalg::OnOK() 
{
	// TODO: Add extra validation here
	if(UpdateData())
	{
		int nFrom,nTo;
		nFrom=pview->GetEditCtrl().GetLineCount();
		if (m_gotonumber>nFrom)
			m_gotonumber=nFrom;
		else if(m_gotonumber<1)
			m_gotonumber=1;
		//pview->GetEditCtrl().LineScroll(m_gotonumber-1);
		nFrom=pview->GetEditCtrl().LineIndex(m_gotonumber-1);
		pview->GetEditCtrl().SetSel(nFrom,nFrom);
		nTo=pview->GetEditCtrl().LineLength();
		pview->GetEditCtrl().SetSel(nFrom,nFrom+nTo);
		pview->SetFocus();
	}
	else
		ShowmessgeBar("输入错误!");

	//CDialog::OnOK();
}

⌨️ 快捷键说明

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