在MFC中有多个slider时OnHScroll函数响应哪一个的处理方法

来源:互联网 发布:maka软件下载(中文版) 编辑:程序博客网 时间:2024/05/16 16:09

原文:http://www.educity.cn/develop/460342.html


在OnHScroll开始时添加几个CWnd*变量,在和参数中pScrollBar判断就可以了

  void CPlayerDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)

  {

  // TODO: Add your message handler code here and/or call default

  CWnd *pSliderPos = this->GetDlgItem(IDC_SLIDER_POS);

  CWnd *pSliderVolume = this->GetDlgItem(IDC_SLIDER_VOLUME);

  if (pScrollBar == pSliderVolume)

  {

  。。。 。。。

  }

  if (pScrollBar == pSliderPos)

  {

  。。。 。。。

  }

  CBitmapDialog::OnHScroll(nSBCode, nPos, pScrollBar);

0 0