共用方式為


CMFCToolBar::GetItemRect

Returns the bounding rectangle of the button at a specified index.

virtual void GetItemRect(
   int nIndex,
   LPRECT lpRect 
) const;

Parameters

  • [in] nIndex
    Specifies the index of a toolbar button.

  • [out] lpRect
    A pointer to CRect object that receives the coordinates of the image bounding rectangle.

Remarks

The CRect object to which lpRect points is set to 0 if a button at the specified index does not exist.

Example

The following example demonstrates how to use the GetItemRect method of the CMFCToolBar class. This code snippet is part of the IE Demo sample.

    CMFCToolBar     m_wndToolBar;


...


    CRect rectToolBar;
    m_wndToolBar.GetItemRect(0, &rectToolBar);

Requirements

Header: afxtoolbar.h

See Also

Reference

CMFCToolBar Class

Hierarchy Chart