// MySlider.cpp : implementation file
//
#include "stdafx.h"
#include "MySlider.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMySlider
CMySlider::CMySlider()
{
m_iLength = 0;
m_iCurrentPos = 0;
}
CMySlider::~CMySlider()
{
}
BEGIN_MESSAGE_MAP(CMySlider, CSliderCtrl)
//{{AFX_MSG_MAP(CMySlider)
ON_WM_LBUTTONDOWN()
ON_WM_CREATE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMySlider message handlers
void CMySlider::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CSliderCtrl::OnLButtonDown(nFlags, point);
CRect rectClient,rectChannel;
GetClientRect(rectClient);
GetChannelRect(rectChannel);
int nMax = 0;
int nMin = 0;
GetRange(nMin,nMax);
int nPos =
(nMax - nMin)*(point.x - rectClient.left - rectChannel.left)/(rectChannel.right - rectChannel.left);
SetPos(nPos);
CSliderCtrl::OnLButtonDown(nFlags, point);
}
int CMySlider::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CSliderCtrl::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
// SetRange(0, 500);
return 0;
}
MFC中鼠标准确定位滑块位置
5星 · 超过95%的资源 需积分: 20 86 浏览量
2014-09-13
19:38:22
上传
评论
收藏 1KB ZIP 举报
_ALittleMore_
- 粉丝: 7
- 资源: 10
最新资源
- 蓝桥杯2024年第十五届省赛真题-前缀总分
- com.qihoo.appstore_300101305-1.apk
- tensorflow-gpu-2.7.1-cp37-cp37m-manylinux2010-x86-64.whl
- tensorflow-2.7.2-cp37-cp37m-manylinux2010-x86-64.whl
- tensorflow-2.7.1-cp39-cp39-manylinux2010-x86-64.whl
- 蓝桥杯2024年第十五届省赛真题-传送阵
- com.qihoo.appstore_300101305.apk
- linux之线程同步一.doc
- keil5配色方案10种
- python烟花代码.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈