Beispiel #1
0
LRESULT CMyScrollBar::OnHScroll(WPARAM wParam, LPARAM lParam)
{
	UNREFERENCED_PARAMETER(lParam);

	// Get a pointer to the MyDialog object
	CMyDialog* pMyDialog = GetDialogApp()->GetDialog();

	GetScrollInfo(&m_si);

	switch (LOWORD (wParam))
	{
	// user clicked left arrow
	case SB_LINELEFT:
		m_si.nPos -= 1;
		break;

	// user clicked right arrow
	case SB_LINERIGHT:
		m_si.nPos += 1;
		break;

	// user clicked the scroll bar shaft left of the scroll box
	case SB_PAGELEFT:
		m_si.nPos -= m_si.nPage;
		break;

	// user clicked the scroll bar shaft right of the scroll box
	case SB_PAGERIGHT:
		m_si.nPos += m_si.nPage;
		break;

	// user dragged the scroll box
	case SB_THUMBTRACK:
		m_si.nPos = m_si.nTrackPos;
		break;

	default :
		break;
	}

	pMyDialog->SetScroll(m_si.nPos);			// Set the scroll bar position
	pMyDialog->SetSlider(m_si.nPos);			// Set the slider position
	pMyDialog->SetProgress(m_si.nPos);		 // Set the progress bar position
	pMyDialog->SetStatic(FALSE, m_si.nPos);	 // Set the static text

	return 0L;
}
Beispiel #2
0
LRESULT CMySlider::OnMessageReflect(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	UNREFERENCED_PARAMETER(wParam);
	UNREFERENCED_PARAMETER(lParam);

	switch (uMsg)
	{
	case WM_HSCROLL:
		{
			// Get the slider bar position
			int nPos = GetPos();

			// Get a pointer to the MyDialog object
			CMyDialog* pMyDialog = GetDialogApp()->GetDialog();

			pMyDialog->SetProgress(nPos);		// Set the progress bar position
			pMyDialog->SetScroll(nPos);			// Set the scroll bar position
			pMyDialog->SetStatic(TRUE, nPos);	// Set the static text
			break;
		}
	}

	return 0;
}