本文整理汇总了C++中CEdit::GetClientRect方法的典型用法代码示例。如果您正苦于以下问题:C++ CEdit::GetClientRect方法的具体用法?C++ CEdit::GetClientRect怎么用?C++ CEdit::GetClientRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEdit
的用法示例。
在下文中一共展示了CEdit::GetClientRect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreatePropertyInterfaceForIndex
HRESULT CPropertyEditWindow::CreatePropertyInterfaceForIndex(DWORD dwPropertyInfoIndex, DWORD dwIndex, RECT& labelRect)
{
HRESULT hr = S_OK;
LPWSTR strName = NULL;
LPWSTR strValue = NULL;
VARTYPE vt;
ITedPropertyInfo* pPropertyInfo = m_arrPropertyInfo[dwPropertyInfoIndex];
PropertyInfoDisplay* pDisplay = m_arrPropertyInfoDisplay[dwPropertyInfoIndex];
RECT clientRect;
GetClientRect(&clientRect);
DWORD dwViewWidth = clientRect.right - clientRect.left - ms_MarginWidth;
IFC( pPropertyInfo->GetProperty(dwIndex, &strName, &strValue) );
IFC( pPropertyInfo->GetPropertyType(dwIndex, &vt) );
IFC( CreatePropertyLabel(dwPropertyInfoIndex, strName, labelRect) );
labelRect.left = labelRect.right + ms_MarginWidth;
labelRect.right = dwViewWidth - ms_MarginWidth;
bool fReadOnly = false;
if(vt == VT_EMPTY || vt == VT_UNKNOWN || vt == (VT_VECTOR | VT_UI1))
{
fReadOnly = true;
}
IFC( CreatePropertyEdit(dwPropertyInfoIndex, strValue, labelRect, fReadOnly) );
RECT rectEditClient;
CEdit* pEditWnd = pDisplay->m_arrEdits.GetAt(pDisplay->m_arrEdits.GetCount() - 1);
pEditWnd->GetClientRect(&rectEditClient);
IFC( CreatePropertyTooltip(dwPropertyInfoIndex, pEditWnd->m_hWnd, GetTextForVartype(vt), rectEditClient) );
pEditWnd->SetToolTipControl(pDisplay->m_arrTooltips.GetAt(pDisplay->m_arrTooltips.GetCount() -1));
m_arrPropertyInfoDisplay[dwPropertyInfoIndex]->m_arrVartypes.Add(vt);
labelRect.left = ms_MarginWidth;
labelRect.right = labelRect.left + dwViewWidth / 2;
labelRect.top += ms_LabelHeight;
labelRect.bottom += ms_LabelHeight;
m_lastRect = labelRect;
Cleanup:
if(strName) CoTaskMemFree(strName);
if(strValue) CoTaskMemFree(strValue);
// If there was a failure, roll back changes to the property displays
if(FAILED(hr))
{
PropertyInfoDisplay* pDisplay = m_arrPropertyInfoDisplay[dwPropertyInfoIndex];
if(pDisplay->m_arrVartypes.GetCount() < pDisplay->m_arrEdits.GetCount())
{
DWORD dwIndex = DWORD( pDisplay->m_arrEdits.GetCount() - 1 );
pDisplay->m_arrEdits[dwIndex]->DestroyWindow();
delete pDisplay->m_arrEdits[dwIndex];
pDisplay->m_arrEdits.RemoveAt(pDisplay->m_arrEdits.GetCount() - 1);
}
if(pDisplay->m_arrVartypes.GetCount() < pDisplay->m_arrTooltips.GetCount())
{
pDisplay->m_arrTooltips.RemoveAt(pDisplay->m_arrTooltips.GetCount() - 1);
}
if(pDisplay->m_arrVartypes.GetCount() < pDisplay->m_arrLabels.GetCount())
{
DWORD dwIndex = DWORD( pDisplay->m_arrLabels.GetCount() - 1 );
pDisplay->m_arrLabels[dwIndex]->DestroyWindow();
delete pDisplay->m_arrLabels[dwIndex];
pDisplay->m_arrLabels.RemoveAt(pDisplay->m_arrLabels.GetCount() - 1);
}
labelRect = m_lastRect;
}
return hr;
}