本文整理汇总了C++中CDuiString::Format方法的典型用法代码示例。如果您正苦于以下问题:C++ CDuiString::Format方法的具体用法?C++ CDuiString::Format怎么用?C++ CDuiString::Format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDuiString
的用法示例。
在下文中一共展示了CDuiString::Format方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddImage
void CSysSkinLayoutUI::AddImage(CString szImage)
{
ASSERT(szImage);
CDuiString sImage;
sImage.Format(_T("file='%s' dest='8,8,132,92' corner='5,5,5,5'"),szImage.GetString());
CDuiString sUserData;
sUserData.Format(_T("file='%s' corner='5,5,5,5'"),szImage.GetString());
if (_ImageCount<SysRowNum-1)
{
_pImage[_ImageCount]->SetNormalImage(sImage);
_pImage[_ImageCount]->SetUserData(sUserData);
_pImage[_ImageCount]->SetVisible(true);
_ImageCount ++;
_pImage[_ImageCount]->SetVisible(true);
}
else if(_ImageCount==SysRowNum-1)
{
_pImage[_ImageCount]->SetNormalImage(sImage);
_pImage[_ImageCount]->SetUserData(sUserData);
_pImage[_ImageCount]->SetVisible(true);
_ImageCount ++;
}
else
{
}
}
示例2: OnWeiboContentNotify
bool main_frame::OnWeiboContentNotify( void *param )
{
TNotifyUI *pNotify = (TNotifyUI *)param;
if (_tcsicmp(pNotify->pSender->GetName() , _T("weiboContent")) == 0)
{
CRichEditUI *pRichEdit = static_cast<CRichEditUI*>(pNotify->pSender);
if (pRichEdit && (_tcsicmp(pNotify->sType,_T("richEditTxViewChanged")) == 0))
{
CDuiString strText = pRichEdit->GetText();
int length = strText.GetLength();
if (length < 140)
{
CDuiString strLimit;
strLimit.Format(_T("%d"),140-length);
CLabelUI *pLabel = static_cast<CLabelUI*>(m_PaintManager.FindControl(_T("limitTextLength")));
if (pLabel)
{
pLabel->SetText(strLimit);
}
}
}
}
return true;
}
示例3: Notify
void CTestWndWindow::Notify(TNotifyUI& msg)
{
CDuiString strCtrlName = msg.pSender->GetName();
if(msg.sType == _T("click"))
{
if(strCtrlName == _T("NewItemBtn"))
{
int j = index++;
CDuiString strTxt;
strTxt.Format(L"±êÇ©%d", j);
static CDuiString strAttrOptionEx = _T("float=\"false\" group=\"group1\" maxwidth=\"174\" normalimage=\"file=\'TabBtnBk.png\' corner=\'15,15,15,15\' source=\'0,0,87,30\'\" hotimage=\"file=\'TabBtnBk.png\' corner=\'15,15,15,15\' source=\'87,0,174,30\'\" selectedimage=\"file=\'TabBtnBk.png\' corner=\'15,15,15,15\' source=\'174,0,261,30\'\" ");
COptionExUI* pNewOption = new COptionExUI;
pNewOption->ApplyAttributeList(strAttrOptionEx);
pNewOption->SetText(strTxt);
CTagMoveUI* pNewTagMove = new CTagMoveUI;
pNewTagMove->ApplyAttributeList(_T("maxwidth=\"174\" "));
pNewTagMove->Add(pNewOption);
m_pTagLayout->AddAt(pNewTagMove, m_pTagLayout->GetCount());
pNewOption->Activate();
}
if(strCtrlName == _T("closebtn"))
{
PostQuitMessage(0L);
}
}
}
示例4: OnCreate
LRESULT CShadowWindow::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
// 使用xml字符串形式加载皮肤,内容很简单,一个Container控件就够了!Window要有bktrans属性
CDuiString xml;
xml.Append(_T("<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>"));
xml.Append(_T("<Window size=\"%d,%d\" bktrans=\"true\">"));
xml.Append(_T(" <Container />"));
xml.Append(_T("</Window>"));
xml.Format(xml.GetData(), m_pShadowUI->GetFixedWidth(), m_pShadowUI->GetFixedHeight());
m_pManager->Init(m_hWnd);
CDialogBuilder builder;
CControlUI* pRoot = builder.Create((LPCTSTR)xml, (UINT)0, NULL, m_pManager);
if (pRoot == NULL)
{
MessageBox(m_hWnd, _T("加载资源文件失败"), _T("错误"), MB_OK | MB_ICONERROR);
ExitProcess(1);
return 0;
}
m_pManager->AttachDialog(pRoot);
// 为主窗口设置一个属性,内容为阴影窗口的指针,然后子类化主窗口
::SetProp(m_hWndOwner, SHADOW_WINDOW_PROP, (HANDLE) this);
m_pOldOwnerProc = (WNDPROC) ::SetWindowLongPtr(m_hWndOwner, GWL_WNDPROC, (LONG) OwnerProc);
return 0;
}
示例5: UpdateText
void CProgressUI::UpdateText()
{
if(m_bShowText) {
CDuiString sText;
sText.Format(_T("%.0f%%"), (m_nValue - m_nMin) * 100.0f / (m_nMax - m_nMin));
SetText(sText);
}
}
示例6: OpenDir
void CFileUtil::OpenDir(HWND hwndOwner,CDuiString path,CDuiString fileName)
{
CDuiString str;
str.Format(L"/select,%s",path);
str.Append(L"\\");
str.Append(fileName);
ShellExecute(hwndOwner,_T("open"),_T("Explorer.exe"),str,NULL,SW_SHOWNORMAL);
}
示例7: SearchGo
void CMainWnd::SearchGo()
{
CDuiString sText = m_pSearchEdit->GetText();
if(!sText.IsEmpty()) {
CDuiString sUrl;
sUrl.Format(_T("https://www.baidu.com/s?ie=utf-8&wd=%s"), sText.GetData());
CreateNewTabAndGo(sUrl);
}
}
示例8: OnTimer
LRESULT OnTimer(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
m_timer_count++;
float progress = (float)m_timer_count / 1070 * 100;
if (progress <= 100)
{
CDuiString progress_str;
progress_str.Format(_T("%.1f%%"), progress);
m_progress_text->SetText(progress_str);
}
if (m_cutting)
{
RECT rcClient = { 0 };
::GetClientRect(m_hWnd, &rcClient);
::InvalidateRect(m_hWnd, &rcClient, false);
}
else
{
CDuiString img_str;
switch (m_cur_index)
{
case 0:
m_cut_size += 2;
img_str.Format(_T("file='Big.jpg' source='0,0,284,602' dest='0,%d,284,%d' fade='%d'"), m_cut_size, 602 + m_cut_size, 255 * (20 - m_cut_size) / 20);
break;
case 1:
m_cut_size += 2;
img_str.Format(_T("file='Big.jpg' source='284,0,902,%d' dest='0,%d,618,40' fade='%d'"), 40 - m_cut_size, m_cut_size, 255 * (20 - m_cut_size) / 20);
break;
case 2:
m_cut_size += 2;
img_str.Format(_T("file='Big.jpg' source='632,40,902,602' dest='0,%d,270,%d' fade='%d'"), m_cut_size, 562 + m_cut_size, 255 * (20 - m_cut_size) / 20);
break;
case 3:
m_cut_size += 2;
img_str.Format(_T("file='Big.jpg' source='284,%d,632,602' dest='0,0,348,%d' fade='%d'"), 572 + m_cut_size, 30 - m_cut_size, 255 * (20 - m_cut_size) / 20);
break;
default:
break;
}
blocks[m_cur_index]->SetBkImage(img_str);
if (m_cut_size >= 20)
{
m_cutting = true;
m_cut_size = 0;
m_cur_index++;
CDuiString bkimage;
bkimage.Format(_T("wording%d.png"), m_cur_index + 1);
m_center_img->SetBkImage(bkimage);
}
}
return 0;
}
示例9: GetApp
CDuiString GetApp()
{
CDuiString str;
TCHAR szCurrentDir[MAX_PATH] = {0};
::GetCurrentDirectory(MAX_PATH, szCurrentDir); // 获得APP文件路径名
str.Format(_T("%s"), szCurrentDir);
return str;
}
示例10:
CDuiString CMP3Info::GetLengthString(int nSeconds)
{
int nMin = nSeconds / 60;
int nSec = nSeconds % 60;
CDuiString str;
str.Format(_T("%d:%02d"),nMin,nSec);
return str;
}
示例11: AddFiles
void CDuiFrameWnd::AddFiles( const std::vector<PlayFileInfo> &vctString, bool bInit )
{
COptionUI *pOptionTmp;
CVerticalLayoutUI* pLayout = NULL;
CDuiString strTmp;
TCHAR szName[_MAX_FNAME];
TCHAR szExt[_MAX_EXT];
unsigned i, uWantedCount;
pLayout = static_cast<CVerticalLayoutUI*>(m_PaintManager.FindControl(_T("playlist")));
if (! pLayout)
{
return;
}
for(i = 0, uWantedCount = 0; i < vctString.size(); i++)
{
if (IsWantedFile(vctString[i].szFileName))
{
_tsplitpath_s(vctString[i].szFileName, NULL, 0, NULL, 0, szName, _MAX_FNAME, szExt, _MAX_EXT);
strTmp.Format(_T("%s%s"), szName, szExt); // 文件名
pOptionTmp = new COptionUI;
pOptionTmp->SetTextColor(0xFFC8C6CB);
pOptionTmp->SetHotTextColor(0xFFC8C6CB);
pOptionTmp->SetSelectedTextColor(0xFFC8C6CB);
pOptionTmp->SetTag(U_TAG_PLAYLIST);
pOptionTmp->SetText(strTmp);
pOptionTmp->SetAttribute(_T("height"), _T("22"));
pOptionTmp->SetAttribute(_T("inset"), _T("7,0,0,0"));
pOptionTmp->SetAttribute(_T("align"), _T("center"));
pOptionTmp->SetAttribute(_T("font"),_T("4"));
pOptionTmp->SetUserData(vctString[i].szFileName);
pOptionTmp->SetName(vctString[i].szFileName);
pOptionTmp->SetSelectedImage(_T("file='btn_bk.png'"));
pLayout->Add(pOptionTmp);
uWantedCount++;
if (! bInit)
{
m_cPlayList.Add(vctString[i]); // 完整路径
}
}
}
Rand(m_queRand, uWantedCount);
ShowPlaylist(true);
}
示例12: DrawItemExpland
void CMenuElementUI::DrawItemExpland(HDC hDC, const RECT& rcItem)
{
if (m_bShowExplandIcon)
{
CDuiString strExplandIcon;
strExplandIcon = GetManager()->GetDefaultAttributeList(_T("ExplandIcon"));
CDuiString strBkImage;
strBkImage.Format(_T("file='%s' dest='%d,%d,%d,%d'"), strExplandIcon.GetData(),
m_cxyFixed.cx - ITEM_DEFAULT_EXPLAND_ICON_WIDTH + (ITEM_DEFAULT_EXPLAND_ICON_WIDTH - ITEM_DEFAULT_EXPLAND_ICON_SIZE)/2,
(m_cxyFixed.cy - ITEM_DEFAULT_EXPLAND_ICON_SIZE)/2,
m_cxyFixed.cx - ITEM_DEFAULT_EXPLAND_ICON_WIDTH + (ITEM_DEFAULT_EXPLAND_ICON_WIDTH - ITEM_DEFAULT_EXPLAND_ICON_SIZE)/2 + ITEM_DEFAULT_EXPLAND_ICON_SIZE,
(m_cxyFixed.cy - ITEM_DEFAULT_EXPLAND_ICON_SIZE)/2 + ITEM_DEFAULT_EXPLAND_ICON_SIZE);
CRenderEngine::DrawImageString(hDC, m_pManager, m_rcItem, m_rcPaint, strBkImage, _T(""));
}
}
示例13: AddNode
bool CBookClient::AddNode(BOOK_INFO *item)
{
if (item == NULL) return false;
BOOK_INFO *node = new BOOK_INFO;
node->strName = item->strName;
node->nImage = item->nImage;
node->strPath = item->strPath;
node->nBookmark = item->nBookmark;
CContainerUI* pDesk = NULL;
if( !m_dlgBuilder.GetMarkup()->IsValid() )
{
pDesk = static_cast<CContainerUI*>(m_dlgBuilder.Create(_T("iBook.xml"), (UINT)0, NULL, &m_pm));
}
else
{
pDesk = static_cast<CContainerUI*>(m_dlgBuilder.Create((UINT)0, &m_pm));
}
if( pDesk != NULL )
{
this->Add(pDesk);
CButtonUI* btn = static_cast<CButtonUI*>(m_pm.FindSubControlByName(pDesk, _T("btnBookEx")));
CLabelUI *text = static_cast<CLabelUI*>(m_pm.FindSubControlByName(pDesk, _T("labelBookEx")));
CButtonUI *btnEdit = static_cast<CButtonUI*>(m_pm.FindSubControlByName(pDesk, _T("btnbookdel")));
if (btn == NULL || text == NULL || btnEdit == NULL) return false;
CDuiString strImage;
strImage.Format(_T("book\\%02d.png"), node->nImage);
btn->SetBkImage(strImage);
text->SetText(node->strName);
btnEdit->SetVisible(m_bEdit);
pDesk->SetTag((UINT_PTR)node);
}
else
{
delete node;
node = NULL;
return false;
}
return true;
}
示例14: SetNodeLastWord
void CGroupsUI::SetNodeLastWord(Node* node, CString strLastWord, int nTime)
{
if (node)
{
CLabelUI* l_time = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(node->data().list_elment_, kTimeControlName));
CLabelUI* l_lastword = static_cast<CLabelUI*>(paint_manager_.FindSubControlByName(node->data().list_elment_, kLastWordControlName));
if (l_time != NULL)
{
CDuiString lastwordtime = _T("");
lastwordtime.Format("%02d:%02d", nTime/100, nTime%100);
l_time->SetText(lastwordtime);
}
if (l_lastword != NULL)
l_lastword->SetText(strLastWord);
}
}
示例15: DrawItemIcon
void CMenuElementUI::DrawItemIcon(HDC hDC, const RECT& rcItem)
{
if ( m_strIcon != _T("") )
{
if (!(m_bCheckItem && !GetChecked()))
{
CDuiString pStrImage;
pStrImage.Format(_T("file='%s' dest='%d,%d,%d,%d'"), m_strIcon.GetData(),
(ITEM_DEFAULT_ICON_WIDTH - m_szIconSize.cx)/2,
(m_cxyFixed.cy - m_szIconSize.cy)/2,
(ITEM_DEFAULT_ICON_WIDTH - m_szIconSize.cx)/2 + m_szIconSize.cx,
(m_cxyFixed.cy - m_szIconSize.cy)/2 + m_szIconSize.cy);
CRenderEngine::DrawImageString(hDC, m_pManager, m_rcItem, m_rcPaint, pStrImage, _T(""));
}
}
}