本文整理汇总了C++中CDuiString::SmallFormat方法的典型用法代码示例。如果您正苦于以下问题:C++ CDuiString::SmallFormat方法的具体用法?C++ CDuiString::SmallFormat怎么用?C++ CDuiString::SmallFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDuiString
的用法示例。
在下文中一共展示了CDuiString::SmallFormat方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateText
void CDateTimeUI::UpdateText()
{
if (m_nDTUpdateFlag == DT_DELETE)
SetText(_T(""));
else if (m_nDTUpdateFlag == DT_UPDATE)
{// 修改者:YYM 时间:2015-7-22
CDuiString sText;
if ((m_dwStyle == DTS_SHORTDATEFORMAT) || (m_dwStyle == DTS_SHORTDATECENTURYFORMAT))
{//显示短日期
sText.SmallFormat(_T("%4d-%02d-%02d"),
m_sysTime.wYear, m_sysTime.wMonth, m_sysTime.wDay);
}
else if (m_dwStyle == DTS_TIMEFORMAT)
{// 显示时间
sText.SmallFormat(_T("%02d:%02d:%02d"),
m_sysTime.wHour, m_sysTime.wMinute,m_sysTime.wSecond);
}
else
{// 显示长日期
sText.SmallFormat(_T("%4d年%02d月%02d日"),
m_sysTime.wYear, m_sysTime.wMonth, m_sysTime.wDay);
}
SetText(sText);
}
}
示例2: DoPaint
void CDateTimeUI::DoPaint(HDC hDC, const RECT& rcPaint)// Hujq 2015.09.02-06
{
if (m_nDTUpdateFlag == DT_DELETE)
{
if(!GetEnabledEffect())
m_sText = _T("");
else
m_TextValue = _T("") ;
}
else if (m_nDTUpdateFlag == DT_UPDATE)
{
CDuiString sText;
switch(m_nType)
{
case 0:
sText.SmallFormat(_T("%4d-%02d-%02d"),
m_sysTime.wYear, m_sysTime.wMonth, m_sysTime.wDay);
break;
case 1:
sText.SmallFormat(_T("%4d-%02d"),m_sysTime.wYear, m_sysTime.wMonth);
break;
case 2:
sText.SmallFormat(_T("%4d"),m_sysTime.wYear);
break;
default:break;
}
if(!GetEnabledEffect())
m_sText = sText;
else
m_TextValue = sText;
}
CControlUI::DoPaint(hDC,rcPaint);
}
示例3: PaintStatusImage
void CComboBoxUI::PaintStatusImage(HDC hDC)
{
if (m_sArrowImage.IsEmpty())
CComboUI::PaintStatusImage(hDC);
else
{
// get index
if( IsFocused() ) m_uButtonState |= UISTATE_FOCUSED;
else m_uButtonState &= ~ UISTATE_FOCUSED;
if( !IsEnabled() ) m_uButtonState |= UISTATE_DISABLED;
else m_uButtonState &= ~ UISTATE_DISABLED;
int nIndex = 0;
if ((m_uButtonState & UISTATE_DISABLED) != 0)
nIndex = 4;
else if ((m_uButtonState & UISTATE_PUSHED) != 0)
nIndex = 2;
else if ((m_uButtonState & UISTATE_HOT) != 0)
nIndex = 1;
else if ((m_uButtonState & UISTATE_FOCUSED) != 0)
nIndex = 3;
// make modify string
CDuiString sModify = m_sArrowImage;
int nPos1 = sModify.Find(_T("source"));
int nPos2 = sModify.Find(_T("'"), nPos1 + 7);
if (nPos2 == -1) return; //first
int nPos3 = sModify.Find(_T("'"), nPos2 + 1);
if (nPos3 == -1) return; //second
CDuiRect rcBmpPart;
LPTSTR lpszValue = NULL;
rcBmpPart.left = _tcstol(sModify.GetData() + nPos2 + 1, &lpszValue, 10); ASSERT(lpszValue);
rcBmpPart.top = _tcstol(lpszValue + 1, &lpszValue, 10); ASSERT(lpszValue);
rcBmpPart.right = _tcstol(lpszValue + 1, &lpszValue, 10); ASSERT(lpszValue);
rcBmpPart.bottom = _tcstol(lpszValue + 1, &lpszValue, 10); ASSERT(lpszValue);
m_nArrowWidth = rcBmpPart.GetWidth() / 5;
rcBmpPart.left += nIndex * m_nArrowWidth;
rcBmpPart.right = rcBmpPart.left + m_nArrowWidth;
CDuiRect rcDest(0, 0, m_rcItem.right - m_rcItem.left, m_rcItem.bottom - m_rcItem.top);
rcDest.Deflate(GetBorderSize(), GetBorderSize());
rcDest.left = rcDest.right - m_nArrowWidth;
CDuiString sSource = sModify.Mid(nPos1, nPos3 + 1 - nPos1);
CDuiString sReplace;
sReplace.SmallFormat(_T("source='%d,%d,%d,%d' dest='%d,%d,%d,%d'"),
rcBmpPart.left, rcBmpPart.top, rcBmpPart.right, rcBmpPart.bottom,
rcDest.left, rcDest.top, rcDest.right, rcDest.bottom);
sModify.Replace(sSource, sReplace);
// draw image
if (!DrawImage(hDC, m_sArrowImage, sModify))
m_sNormalImage.Empty();
}
}
示例4: UpdateText
void CDateTimeUI::UpdateText()
{
if (m_nDTUpdateFlag == DT_DELETE) {
SetText(_T(""));
}
else if (m_nDTUpdateFlag == DT_UPDATE) {
CDuiString sText;
sText.SmallFormat(_T("%4d-%02d-%02d"), m_sysTime.wYear, m_sysTime.wMonth, m_sysTime.wDay, m_sysTime.wHour, m_sysTime.wMinute);
SetText(sText);
}
}
示例5: UpdateText
void CDateTimeUI::UpdateText()
{
if (m_nDTUpdateFlag == DT_DELETE)
SetText(_T(""));
else if (m_nDTUpdateFlag == DT_UPDATE)
{
CDuiString sText;
switch(m_nType)
{
case 0:
sText.SmallFormat(_T("%4d-%02d-%02d"),
m_sysTime.wYear, m_sysTime.wMonth, m_sysTime.wDay);
break;
case 1:
sText.SmallFormat(_T("%4d-%02d"),m_sysTime.wYear, m_sysTime.wMonth);
break;
case 2:
sText.SmallFormat(_T("%4d"),m_sysTime.wYear);
break;
default:break;
}
SetText(sText);
}
}