本文整理汇总了C++中CComboBox::GetParent方法的典型用法代码示例。如果您正苦于以下问题:C++ CComboBox::GetParent方法的具体用法?C++ CComboBox::GetParent怎么用?C++ CComboBox::GetParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComboBox
的用法示例。
在下文中一共展示了CComboBox::GetParent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AutoSetComboBoxHeight
void AutoSetComboBoxHeight(CComboBox& c)
{
int itemCount = c.GetCount() + 1;
int itemHeight = c.GetItemHeight(0);
int editAreaHeight = c.GetItemHeight(0);
int targetHeight = editAreaHeight + (itemHeight * itemCount);
RECT rc;
c.GetWindowRect(&rc);
c.GetParent().ScreenToClient(&rc);
rc.bottom = rc.top + targetHeight;
c.MoveWindow(&rc, FALSE);
}
示例2: DoPageEdit
bool CPatchUndoTest::DoPageEdit(CWnd *pParent, CString& PageName, CString& CtrlCaption)
{
CHWNDArray Ctrl;
CTabbedDlg *pTabDlg = GetPageControls(pParent, PageName, Ctrl);
ASSERT(pTabDlg != NULL);
ASSERT(Ctrl.GetSize());
int iCtrl = Random(Ctrl.GetSize());
CWnd *pWnd = CWnd::FromHandle(Ctrl[iCtrl]);
if (pWnd == NULL || !pWnd->IsWindowEnabled()) // skip disabled controls
return(FALSE);
UINT nID = pWnd->GetDlgCtrlID();
CtrlCaption = pTabDlg->GetControlCaption(nID);
CNumEdit *pNumEdit = DYNAMIC_DOWNCAST(CNumEdit, pWnd);
if (pNumEdit != NULL) {
double val = pNumEdit->GetVal();
pNumEdit->AddSpin(1);
if (pNumEdit->GetVal() == val)
pNumEdit->AddSpin(-1);
return(TRUE);
}
CComboBox *pCombo = DYNAMIC_DOWNCAST(CComboBox, pWnd);
if (pCombo != NULL) {
int nItems = pCombo->GetCount();
if (nID == IDC_PATCH_GEN_PPQ) // if PPQ combo
nItems /= 4; // limit range to avoid zero timer period
int iItem = RandomExcluding(nItems, pCombo->GetCurSel());
if (iItem < 0)
return(FALSE);
pCombo->SetCurSel(iItem);
pCombo->GetParent()->SendMessage(WM_COMMAND,
MAKELONG(pCombo->GetDlgCtrlID(), CBN_SELCHANGE));
return(TRUE);
}
CButton *pBtn = DYNAMIC_DOWNCAST(CButton, pWnd);
if (pBtn != NULL) {
pBtn->SetCheck(!pBtn->GetCheck());
pBtn->GetParent()->SendMessage(WM_COMMAND,
MAKELONG(pBtn->GetDlgCtrlID(), BN_CLICKED));
return(TRUE);
}
return(FALSE);
}