当前位置: 首页>>代码示例>>C++>>正文


C++ CComboBox::GetWindowRect方法代码示例

本文整理汇总了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;
}
开发者ID:wyrover,项目名称:myhistoryprojects,代码行数:31,代码来源:StroeSet.cpp

示例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;
}
开发者ID:hiplayer,项目名称:mpc_hc,代码行数:35,代码来源:PPageBase.cpp

示例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);
}
开发者ID:thenfour,项目名称:screenie,代码行数:12,代码来源:utility.cpp

示例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);
}
开发者ID:Chris-Hood,项目名称:mpc-hc,代码行数:13,代码来源:PlayerListCtrl.cpp


注:本文中的CComboBox::GetWindowRect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。