-
大小: 12.42MB文件類型: .rar金幣: 1下載: 0 次發布日期: 2023-06-13
- 語言: 其他
- 標簽: 源碼??directshow??
資源簡介
基于directShow,打造全能播放器系列之二——簡易播放器的補充 源碼
對應博客地址:
http://blog.csdn.net/harvic880925/article/details/7987798#
此博文僅供交流,轉載請標明出處,謝謝
代碼片段和文件信息
#include?“stdafx.h“
#include?“NiceSlider.h“
IMPLEMENT_DYNAMIC(CNiceSliderCtrl?CSliderCtrl)
BEGIN_MESSAGE_MAP(CNiceSliderCtrl?CSliderCtrl)
//{{AFX_MSG_MAP(CNiceSliderCtrl)
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONUP()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void?CNiceSliderCtrl::OnLButtonDown(UINT?nFlags?CPoint?point)?
{
m_bDragging?=?true;
m_bDragChanged?=?false;
SetCapture();
SetFocus();
if?(SetThumb(point))
{
m_bDragChanged?=?true;
PostMessageToParent(TB_THUMBTRACK);
}
}
void?CNiceSliderCtrl::onmousemove(UINT?nFlags?CPoint?point)?
{
if?(m_bDragging)
{
if?(SetThumb(point))
{
m_bDragChanged?=?true;
PostMessageToParent(TB_THUMBTRACK);
}
}
else
{
CSliderCtrl::onmousemove(nFlags?point);
}
}
void?CNiceSliderCtrl::OnLButtonUp(UINT?nFlags?CPoint?point)?
{
if(m_bDragging)
{
m_bDragging?=?false;
::ReleaseCapture();
if?(SetThumb(point))
{
PostMessageToParent(TB_THUMBTRACK);
m_bDragChanged?=?true;
}
if?(m_bDragChanged)
{
PostMessageToParent(TB_THUMBPOSITION);
m_bDragChanged?=?false;
}
}
else
{
CSliderCtrl::OnLButtonUp(nFlags?point);
}
}
bool?CNiceSliderCtrl::SetThumb(const?CPoint&?point)
{
const?int?nMin?=?GetRangeMin();
const?int?nMax?=?GetRangeMax()+1;
CRect?rc;
GetChannelRect(rc);
double?dPos;
double?dCorrectionFactor?=?0.0;
if?(Getstyle()?&?TBS_VERT)?
{
//?note:?there?is?a?bug?in?GetChannelRect?it?gets?the?orientation?of?the?rectangle?mixed?up
dPos?=?(double)(point.y?-?rc.left)/(rc.right?-?rc.left);
}
else
{
dPos?=?(double)(point.x?-?rc.left)/(rc.right?-?rc.left);
}
//?This?correction?factor?is?needed?when?you?click?inbetween?tick?marks
//?so?that?the?thumb?will?move?to?the?nearest?one
dCorrectionFactor?=?0.5?*(1-dPos)?-?0.5?*dPos;
int?nNewPos?=?(int)(nMin?+?(nMax-nMin)*dPos?+?dCorrectionFactor);
const?bool?bChanged?=?(nNewPos?!=?GetPos());
if(bChanged)
{
SetPos(nNewPos);
}
return?bChanged;
}
void?CNiceSliderCtrl::PostMessageToParent(const?int?nTBCode)?const
{
CWnd*?pWnd?=?GetParent();
if(pWnd)?pWnd->PostMessage(WM_HSCROLL?(WPARAM)((GetPos()?<16)?|?nTBCode)?(LPARAM)GetSafeHwnd());
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????130560??2012-09-17?14:40??Pla
?????文件????1430216??2012-09-17?14:40??Pla
?????文件????4041728??2012-09-17?14:40??Pla
?????文件???????8452??2012-09-17?14:40??Pla
?????文件?????????67??2012-09-17?14:40??Pla
?????文件??????15374??2012-09-14?10:49??Pla
?????文件???????1196??2012-09-14?10:51??Pla
?????文件???????1260??2012-09-14?10:51??Pla
?????文件???????1120??2012-09-17?14:40??Pla
?????文件??????43336??2012-09-17?14:40??Pla
?????文件???25034752??2012-09-14?10:49??Pla
?????文件??????23456??2012-09-17?11:01??Pla
?????文件?????110759??2012-09-17?14:40??Pla
?????文件?????466726??2012-09-14?10:49??Pla
?????文件????1141760??2012-09-17?14:40??Pla
?????文件????2314240??2012-09-17?14:40??Pla
?????文件???????2249??2010-07-29?09:39??Pla
?????文件????????715??2010-07-29?09:39??Pla
?????文件??????59112??2012-09-17?11:00??Pla
?????文件???????1932??2012-09-14?10:20??Pla
?????文件????????471??2012-09-13?15:25??Pla
?????文件???????5449??2012-09-17?11:00??Pla
?????文件???????5774??2012-09-13?15:08??Pla
?????文件???????1423??2012-09-17?15:34??Pla
?????文件??????19060??2012-09-17?14:40??Pla
?????文件???????2676??2012-09-17?14:40??Pla
?????文件???????2873??2012-09-13?14:32??Pla
????.......?????21630??2003-07-24?09:52??Pla
?????文件????????362??2012-09-13?14:32??Pla
?????文件????????954??2012-09-14?16:00??Pla
............此處省略14個文件信息
評論
共有 條評論