CHeaderCtrl::GetItemDropDownRect
获取下拉式按钮的边框一个标头项目的当前标头控件。
BOOL GetItemDropDownRect(
int iItem,
LPRECT lpRect
) const;
参数
Parameter |
说明 |
---|---|
[in] iItem |
样式是 HDF_SPLITBUTTON标头项的从零开始的索引。 有关更多信息,请参见 HDITEM 结构的 fmt 成员。 |
[out] lpRect |
为获取边框的信息的 RECT 结构的指针。 |
返回值
true,如果此功能成功;否则,false。
备注
此方法发送 HDM_GETITEMDROPDOWNRECT 信息,在 Windows SDK所述。
要求
标头: afxcmn.h
此方法在 Windows Vista 和更高版本支持。
此方法的其他要求。Windows vista公共控件的生成要求所述。
示例
下面的代码示例定义任何变量,m_headerCtrl,用于访问当前标头控件。 此变量在下一个示例。
CHeaderCtrl m_headerCtrl;
CSplitButton m_splitButton;
下面的代码示例演示 GetItemDropDownRect 方法。 在代码的早期节中,我们使用五列创建了一个标头控件。 下面的代码示例在为标头下拉式按钮是保留的第一列中的位置周围绘制三维矩形。
void CNVC_MFC_CHeaderCtrl_s4Dlg::OnXGetitemdropdownrect()
{
if (controlCreated == FALSE) {
MessageBox(_T("Header control has not been created yet."));
return;
}
// Get the dropdown rect for the first column.
CRect rect;
BOOL bRetVal = m_headerCtrl.GetItemDropDownRect(0, &rect);
if (bRetVal == TRUE) {
// Draw around the dropdown rect a rectangle that has red
// left and top sides, and blue right and bottom sides.
CDC* pDC = m_headerCtrl.GetDC();
pDC->Draw3dRect(rect, RGB(255, 0, 0), RGB(0, 0, 255));
}
}