//CSliderCtrl
//当控件移动时,会向父窗体发送
//ON_WM_HSCROLL(横向控件发送), ON_WM_VSCROLL(纵向控件发送) 消息
BOOL CPic::OnInitDialog()
{
CDialog::OnInitDialog();
//m_slider 是绑定到控件的控件变量
m_slider.SetRange(0, 255);
m_slider.SetPos(50);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPic::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
//横向CSliderCtrl移动时,
int i = m_slider.GetPos();
CString str;
str.Format("%d", i);
m_edit2 = str;
UpdateData(false);
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}