dbslider.cpp

来自「企业客户管理系统,用来管理客户资料使用VC++语言编写」· C++ 代码 · 共 65 行

CPP
65
字号
// DBSlider.cpp : implementation file
//

#include "stdafx.h"
#include "源程序.h"
#include "DBSlider.h"
#include "RainFunction.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CDBSlider

CDBSlider::CDBSlider()
{
}

CDBSlider::~CDBSlider()
{
}


BEGIN_MESSAGE_MAP(CDBSlider, CSliderCtrl)
	//{{AFX_MSG_MAP(CDBSlider)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDBSlider message handlers

BOOL CDBSlider::PreTranslateMessage(MSG* pMsg) 
{
	int pos;
	CString sPos;
	if(pMsg->message==WM_LBUTTONDOWN || (pMsg->message==WM_KEYDOWN && (pMsg->wParam==37 ||pMsg->wParam==39)))
	{
		try{
		pos=this->GetPos();
		this->Recordset->MoveFirst();
		this->Recordset->Move(pos);
		this->Record=pos;
		sPos.Format("%d",pos);
		}
		catch(...)
		{
			return -1;
		}
	}
	return CSliderCtrl::PreTranslateMessage(pMsg);
}

void CDBSlider::Init()
{
	if(function.RecordCount(this->Recordset)>0)
	{
		this->SetRangeMax(function.RecordCount(this->Recordset),true);
		this->SetRangeMin(1,true);	
	}

}

⌨️ 快捷键说明

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