word中合并单元格在哪:vc++编程求助

来源:百度文库 编辑:中科新闻网 时间:2024/04/30 04:11:33
请看下列代码:
CListCtrl m_CtrlList;
int nSelectIndex
if(nSelectIndex==m_CtrlList.GetItemCount())
nSelectIndex--;
m_CtrlList.EnsureVisible(nSelectIndex,nSelectIndex+5);
m_CtrlList.SetItemState(nSelectIndex, LVIS_SELECTED, LVIS_SELECTED);
请解释一下EnsureVisible()的第二个参数的作用

楼上的拿MSDN上的鸟语来干嘛啊。。。
也不知道自己懂不懂
其实那个参数很简单
bPartialOK就是指如果指定的项是部分显示时的处理方式,即是保持原状还是将其显示出来
就是露出来一半还是全部露出来
在你的程序中意思就是如果Index为nSelectIndex+5的Item存在
则Index为nSelectIndex的Item必须显示出来,并且可以只显示部分
如果Index为nSelectIndex+5的Item不存在,则Index为nSelectIndex的Item必须全部显示出来

函数的作用CListCtrl::EnsureVisible( int nItem, BOOL bPartialOK );

CListCtrl::EnsureVisible
BOOL EnsureVisible( int nItem, BOOL bPartialOK );

Return Value

Nonzero if successful; otherwise zero.

Parameters

nItem

Index of the list view item that is to be visible.

bPartialOK

Specifies whether partial visibility is acceptable.

Remarks

Call this function to ensure that a list view item is at least partially visible. The list view control is scrolled if necessary. If the bPartialOK parameter is nonzero, no scrolling occurs if the item is partially visible.

Example

// The pointer to my list view control.
extern CListCtrl* pmyListCtrl;

// Ensure that the last item is visible.
int nCount = pmyListCtrl->GetItemCount();
if (nCount > 0)
pmyListCtrl->EnsureVisible(nCount-1, FALSE);