CCheckListBox::OnGetCheckPosition

virtual CRect OnGetCheckPosition( CRect rectItem, CRect rectCheckBox );

返回值:返回某个项的复选框的位置和大小。

参数:
rectItem列表项的位置和大小。
rectCheckBox项的复选框的缺省位置和大小。

说明:
本函数由框架调用以取得某个项的复选框的位置和大小。
缺省实现只返回复选框的缺省位置和大小(在rectCheckBox中)。缺省时,复选框在项的左上角和它对齐并具有缺省的大小。应用有时可能需要复选框在项的右边,或者要求它大一些或小一些。这时可以覆盖本函数来改变项中的复选框的位置和大小。
例如,下面的函数就覆盖了缺省的实现,把复选框放在项的右边,并使它和项一样高(减去上下各一个像素的位置),并把宽度设为标准复选框的宽度。
CRect CMyCheckListBox::OnGetCheckPosition( CRect rectItem, CRect rectCheckBox )
{
  CRect rectCMyCheckBox;
  rectCMyCheckBox.top = rectItem.top - 1;
  rectCMyCheckBox.bottom = rectItem.bottom - 1;
  rectCMyCheckBox.right = rectItem.right - 1;
  rectCMyCheckBox.left = rectItem.right - 1 - rectCheckBox.Width( );
  return rectCMyCheckBox;
}

请参阅:
CCheckListBox::SetCheck, CCheckListBox::SetCheckStyle, CCheckListBox::GetCheck, CCheckListBox::GetCheckStyle