CPagerCtrl::SetButtonSize
设置当前页导航控件的按钮大小。
int SetButtonSize(
int iButtonSize
);
参数
Parameter |
说明 |
---|---|
[in] iButtonSize |
新按钮大小,单位是像素。 |
要求
标头: afxcmn.h
返回值
前面的按钮大小,单位是像素。
备注
此方法发送 PGM_SETBUTTONSIZE 信息,在 Windows SDK所述。
如果页导航控件具有 PGS_HORZ 样式,按钮大小确定页导航按钮的宽度,并且,如果页导航控件具有 PGS_VERT 样式,按钮大小确定页导航按钮高度。 默认按钮大小是滚动条的宽度的四分之三,因此,最小按钮大小为12像素。 有关更多信息,请参见 Pager Control Styles。
示例
下面的示例创建一个页导航控件,然后使用 CPagerCtrl::SetChild 方法创建一个很长的按钮控件与页导航控件。 然后该示例使用 CPagerCtrl::SetButtonSize 方法设置页导航控件的高度为20像素、 CPagerCtrl::SetBorder 方法设置边框粗细为1像素。
// Initialize the dropdown menu of the splitbutton control.
m_splitButton.SetDropDownMenu(IDR_MENU1, 0);
// Create the pager control.
BOOL nRet;
CRect rect;
GetClientRect(&rect);
nRet = m_pager.Create(
(WS_VISIBLE | WS_CHILD | PGS_HORZ),
CRect(rect.Width()/4, 5, (rect.Width() * 3)/4, 55),
this,
IDC_PAGER1);
m_pager.GetClientRect( &rect );
nRet = m_button.Create(
_T("This is a very, very long button. 012345678901234567890"),
(WS_VISIBLE | WS_CHILD), // Do not use CCS_NORESIZE.
CRect(0,0,rect.Width(),30),
&m_pager, IDC_BUTTON1);
m_pager.SetChild(m_button.m_hWnd);
m_pager.SetButtonSize( 20 );
m_pager.SetBorder( 1 );