码迷,mamicode.com
首页 > 其他好文 > 详细

OnVScroll的通常处理

时间:2015-05-19 12:13:43      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:

void CDialogLAMP::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
	// TODO:  在此添加消息处理程序代码和/或调用默认值
	SCROLLINFO scrollinfo;

	GetScrollInfo(SB_VERT, &scrollinfo, SIF_ALL);

	switch (nSBCode)

	{

	case SB_BOTTOM:

		ScrollWindow(0, (scrollinfo.nPos - scrollinfo.nMax) * 10);

		scrollinfo.nPos = scrollinfo.nMax;

		SetScrollInfo(SB_VERT, &scrollinfo, SIF_ALL);

		break;

	case SB_TOP:

		ScrollWindow(0, (scrollinfo.nPos - scrollinfo.nMin) * 10);

		scrollinfo.nPos = scrollinfo.nMin;

		SetScrollInfo(SB_VERT, &scrollinfo, SIF_ALL);

		break;

	case SB_LINEUP:

		scrollinfo.nPos -= 1;

		if (scrollinfo.nPos < scrollinfo.nMin)

		{

			scrollinfo.nPos = scrollinfo.nMin;

			break;

		}

		SetScrollInfo(SB_VERT, &scrollinfo, SIF_ALL);

		ScrollWindow(0, 10);

		break;

	case SB_LINEDOWN:

		scrollinfo.nPos += 1;

		if (scrollinfo.nPos > scrollinfo.nMax)

		{

			scrollinfo.nPos = scrollinfo.nMax;

			break;

		}

		SetScrollInfo(SB_VERT, &scrollinfo, SIF_ALL);

		ScrollWindow(0, -10);

		break;

	case SB_PAGEUP:

		scrollinfo.nPos -= 5;

		if (scrollinfo.nPos < scrollinfo.nMin)

		{

			scrollinfo.nPos = scrollinfo.nMin;

			break;

		}

		SetScrollInfo(SB_VERT, &scrollinfo, SIF_ALL);

		ScrollWindow(0, 10 * 5);

		break;

	case SB_PAGEDOWN:

		scrollinfo.nPos += 5;

		if (scrollinfo.nPos > scrollinfo.nMax)

		{

			scrollinfo.nPos = scrollinfo.nMax;

			break;

		}

		SetScrollInfo(SB_VERT, &scrollinfo, SIF_ALL);

		ScrollWindow(0, -10 * 5);

		break;

	case SB_ENDSCROLL:

		// MessageBox("SB_ENDSCROLL"); 

		break;

	case SB_THUMBPOSITION:

		// ScrollWindow(0,(scrollinfo.nPos-nPos)*10); 

		// scrollinfo.nPos = nPos; 

		// SetScrollInfo(SB_VERT,&scrollinfo,SIF_ALL); 

		break;

	case SB_THUMBTRACK:

		ScrollWindow(0, (scrollinfo.nPos - nPos) * 10);

		scrollinfo.nPos = nPos;

		SetScrollInfo(SB_VERT, &scrollinfo, SIF_ALL);

		break;

	}



	CDialogEx::OnVScroll(nSBCode, nPos, pScrollBar);
}

 

OnVScroll的通常处理

标签:

原文地址:http://www.cnblogs.com/beginner/p/4513989.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!