本文整理汇总了C++中CComboBox::GetWindowRect方法的典型用法代码示例。如果您正苦于以下问题:C++ CComboBox::GetWindowRect方法的具体用法?C++ CComboBox::GetWindowRect怎么用?C++ CComboBox::GetWindowRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComboBox
的用法示例。
在下文中一共展示了CComboBox::GetWindowRect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PopulateComboList
LRESULT CStroeSet::PopulateComboList(WPARAM wParam, LPARAM lParam)
{
// Get the Combobox window pointer
CComboBox* pInPlaceCombo = static_cast<CComboBox*> (GetFocus());
//去掉排序属性
// DWORD nStyle = GetWindowLong(pInPlaceCombo->m_hWnd,GWL_STYLE);
// nStyle = nStyle &(~ LBS_SORT);
// SetWindowLong(pInPlaceCombo->m_hWnd,GWL_STYLE,nStyle);
CRect obWindowRect;
pInPlaceCombo->GetWindowRect(&obWindowRect);
//pInPlaceCombo->MoveWindow(obWindowRect.left,obWindowRect.top,obWindowRect.Width(),500);
CPoint obInPlaceComboTopLeft(obWindowRect.TopLeft());
// Get the active list
// Get the control window rect
// If the inplace combobox top left is in the rect then
// The control is the active control
m_List.GetWindowRect(&obWindowRect);
int iColIndex = wParam;
CStringList* pComboList = reinterpret_cast<CStringList*>(lParam);
pComboList->RemoveAll();
if (obWindowRect.PtInRect(obInPlaceComboTopLeft))
{
if (1 == iColIndex)
{
InitComString(pComboList);
}
}
return 0;
}
示例2: FillComboToolTip
bool CPPageBase::FillComboToolTip(CComboBox& comboBox, TOOLTIPTEXT* pTTT)
{
bool bNeedTooltip = false;
CDC* pDC = comboBox.GetDC();
CFont* pFont = comboBox.GetFont();
CFont* pOldFont = pDC->SelectObject(pFont);
TEXTMETRIC tm;
pDC->GetTextMetrics(&tm);
CRect comboBoxRect;
comboBox.GetWindowRect(comboBoxRect);
comboBoxRect.right -= GetSystemMetrics(SM_CXVSCROLL) + 2 * GetSystemMetrics(SM_CXEDGE);
int i = comboBox.GetCurSel();
CString str;
comboBox.GetLBText(i, str);
CSize textSize;
textSize = pDC->GetTextExtent(str);
pDC->SelectObject(pOldFont);
comboBox.ReleaseDC(pDC);
textSize.cx += tm.tmAveCharWidth;
if (textSize.cx > comboBoxRect.Width()) {
bNeedTooltip = true;
if (str.GetLength() > _countof(pTTT->szText) - 1) {
str.Truncate(_countof(pTTT->szText) - 1);
}
_tcscpy_s(pTTT->szText, str);
pTTT->hinst = nullptr;
}
return bNeedTooltip;
}
示例3: 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);
}
示例4: GetItemRect
void CPlayerListCtrl::OnCbnDropdownCombo1()
{
CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_COMBO1);
CRect ir;
GetItemRect(m_nItemClicked, &ir, LVIR_BOUNDS);
CRect r;
pCombo->GetWindowRect(r);
ScreenToClient(r);
r.bottom = r.top + ir.Height() + pCombo->GetItemHeight(0) * 10;
pCombo->MoveWindow(r);
}