1、CMFCPropertyGridCtrl::OnSelectCombo()
Called by the framework when a property that contains a combo box control is selected.
2、Scroll Control
afx_msg void OnHScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar )的参数和作用分析:
https://blog.csdn.net/lanmeng_smile/article/details/25922949
SCROLLINFO结构体:https://www.cnblogs.com/qingergege/p/4983036.html
函数原型:BOOL GetScrolllnfo(HWND hWnd,int fnBar,LPSCROLLINFO lpsi);
参数: hWnd:滚动条控制或有标准滚动条的窗体句柄,由fnBar参数确定。
fnBar:指定待找回滚动条参数的类型,此参数可以为如下值,其值含义: SB_CTL:找回滚动条控制参数。其中参数hwnd一定是处理滚动条控制的句柄。
SB_HORZ:找回所指定窗体的标准水平滚动条参数。
SB_VERT:找回所指定窗体的标准垂直滚动条参数。 lpsi:指向SCROLLINFO结构。
void CMFCScrollDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
SCROLLINFO sInfo = { sizeof(SCROLLINFO) };//sInfo.cbSize = sizeof(sInfo);
if (pScrollBar)
{
pScrollBar->GetScrollInfo(&sInfo);
}
else
{
GetScrollInfo(SB_HORZ, &sInfo);
}
switch (nSBCode)
{
case(SB_LINELEFT):
{
if (sInfo.nPos > sInfo.nMin)
sInfo.nPos--;
break;
}
case(SB_LINERIGHT):
{
if (sInfo.nPos < sInfo.nMax)
sInfo.nPos++;
break;
}
case(SB_PAGELEFT):
{
if (sInfo.nPos > sInfo.nMin)
{
sInfo.nPos -= sInfo.nPage;
if (sInfo.nPos < sInfo.nMin)
sInfo.nPos = sInfo.nMin;
}
break;
}
case(SB_PAGERIGHT):
{
if (sInfo.nPos < sInfo.nMax)
{
sInfo.nPos += sInfo.nPage;
if (sInfo.nPos > sInfo.nMax)
sInfo.nPos = sInfo.nMax;
}
break;
}
case(SB_THUMBPOSITION):
case(SB_THUMBTRACK):
{
sInfo.nPos = nPos;
break;
}
case(SB_LEFT):
{
sInfo.nPos = sInfo.nMin;
break;
}
case(SB_RIGHT):
{
sInfo.nPos = sInfo.nMax;
break;
}
}
if (pScrollBar)
pScrollBar->SetScrollInfo(&sInfo);
else
SetScrollInfo(SB_HORZ, &sInfo);
if (pScrollBar->m_hWnd == m_horiScrollbar.m_hWnd)
{
SetDlgItemInt(IDC_HSCROLL_EDIT, pScrollBar->GetScrollPos());
}
CDialogEx::OnHScroll(nSBCode, nPos, pScrollBar);
}
为什么要写这几句?
if (pScrollBar)
{
pScrollBar->GetScrollInfo(&sInfo);
}
else
{
GetScrollInfo(SB_HORZ, &sInfo);
}
SB_THUMBPOSITION The user has dragged the scroll box (thumb) and released the mouse button. The nPos parameter indicates the position of the scroll box at the end of the drag operation.
SB_THUMBTRACK The user is dragging the scroll box. This message is sent repeatedly until the user releases the mouse button. The nPos parameter indicates the position that the scroll box has been dragged to.