-
Notifications
You must be signed in to change notification settings - Fork 0
/
DlgMagicBar.cpp
58 lines (46 loc) · 1.42 KB
/
DlgMagicBar.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include "StdAfx.h"
#include ".\dlgmagicbar.h"
#include "Resource.h"
IMPLEMENT_DYNAMIC(CDlgMagicBar, CDialogBar)
CDlgMagicBar::CDlgMagicBar(CWnd* pParent /*=NULL*/)
: CDialogBar(/*FCLayerBar::IDD, pParent*/)
{
m_threshold = 30;
}
CDlgMagicBar::~CDlgMagicBar(void)
{
}
void CDlgMagicBar::DoDataExchange(CDataExchange* pDX)
{
CDialogBar::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CDlgMagicBar, CDialogBar)
ON_WM_HSCROLL()
END_MESSAGE_MAP()
BOOL CDlgMagicBar::Create(CWnd* pParentWnd,UINT nIDTemplate,UINT nStyle,UINT nID)
{
BOOL bRes= CDialogBar::Create(pParentWnd,nIDTemplate,nStyle,nID );
InitDialogBar();//在类中添加一个成员函数就可以了
return bRes;
}
BOOL CDlgMagicBar::InitDialogBar()
{
UpdateData(FALSE);//这个一定要啊,这样就会有和CDialog一样的数据交换效果了
CSliderCtrl *pSlideThreshold = (CSliderCtrl *)GetDlgItem(IDC_SLIDER_THRESHOLED);
pSlideThreshold->SetRange(0,200);
pSlideThreshold->SetPos(30);
CString str;
str.Format("%d",pSlideThreshold->GetPos());
SetDlgItemText(IDC_STATIC_THRESHOLD,str);
m_threshold = pSlideThreshold->GetPos();
return TRUE;
}
void CDlgMagicBar::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
CSliderCtrl *pSlideThreshold = (CSliderCtrl *)GetDlgItem(IDC_SLIDER_THRESHOLED);
CString str;
str.Format("%d",pSlideThreshold->GetPos());
SetDlgItemText(IDC_STATIC_THRESHOLD,str);
m_threshold = pSlideThreshold->GetPos();
CDialogBar::OnHScroll(nSBCode, nPos, pScrollBar);
}