RTSlider.cpp
资源名称:realtime.rar [点击查看]
上传用户:mgf822
上传日期:2013-10-03
资源大小:133k
文件大小:2k
源码类别:
对话框与窗口
开发平台:
Visual C++
- // RTSlider.cpp : implementation file
- //
- #include "stdafx.h"
- #include "RTDemo.h"
- #include "RTSlider.h"
- #include "RTDemoDoc.h"
- #include "RTDemoView.h"
- #include "RTForm.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CRTSlider
- CRTSlider::CRTSlider()
- {
- m_sType = TICK;
- m_nCurPos = 0;
- }
- CRTSlider::~CRTSlider()
- {
- }
- BEGIN_MESSAGE_MAP(CRTSlider, CSliderCtrl)
- //{{AFX_MSG_MAP(CRTSlider)
- ON_WM_LBUTTONUP()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CRTSlider message handlers
- void CRTSlider::OnLButtonUp(UINT nFlags, CPoint point)
- {
- m_nCurPos = GetPos();
- if (m_sType == TICK)
- {
- CRTDemoView* pWnd = (CRTDemoView*)GetParent();
- ASSERT_VALID(pWnd);
- if (pWnd->m_Graph.m_nTick == m_nCurPos)
- {
- CSliderCtrl::OnLButtonUp(nFlags, point);
- return;
- }
- else
- {
- pWnd->m_Graph.m_nTick = m_nCurPos;
- pWnd->RefreshGraph();
- }
- }
- else if (m_sType == PAGE)
- {
- CRTForm* pForm = (CRTForm*)GetParent();
- ASSERT_VALID(pForm);
- CRTDemoView* pWnd = (CRTDemoView*)pForm->GetRTDemoView();
- if (pWnd->m_Graph.m_nPage == m_nCurPos)
- {
- CSliderCtrl::OnLButtonUp(nFlags, point);
- return;
- }
- else if (m_nCurPos == GetRangeMax())
- pWnd->m_Graph.m_bAutoScrollX = TRUE;
- else
- pWnd->m_Graph.m_bAutoScrollX = FALSE;
- pWnd->m_Graph.m_nPage = m_nCurPos;
- pWnd->m_Graph.Reset();
- pWnd->RefreshGraph();
- }
- CSliderCtrl::OnLButtonUp(nFlags, point);
- }