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


C++ CDuiString::Mid方法代码示例

本文整理汇总了C++中CDuiString::Mid方法的典型用法代码示例。如果您正苦于以下问题:C++ CDuiString::Mid方法的具体用法?C++ CDuiString::Mid怎么用?C++ CDuiString::Mid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDuiString的用法示例。


在下文中一共展示了CDuiString::Mid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnItemActive

void CStockBuyUI::OnItemActive(TNotifyUI& msg)
{
	if (OrderList != m_iCurList)
	{
		return;
	}

	int iSelect = m_pStockOrderList->GetCurSel();
	CListTextElementUI *pNewElem = new CListTextElementUI;
	CListTextElementUI *pOldElem = static_cast<CListTextElementUI* >(m_pStockOrderList->GetItemAt(iSelect));

	m_pStockOrderList->RemoveAt(iSelect);
	
	pNewElem->SetTag(m_pStockOrderList->GetCount());
	m_pStockOrderList->AddAt(pNewElem, 0);	
	CDuiString strTime = Base::CTimeKit::GetCurDateTime(TIME_FORMAT);
	
	pNewElem->SetText(0, pOldElem->GetText(0));
	pNewElem->SetText(1, pOldElem->GetText(1));	
	pNewElem->SetText(2, pOldElem->GetText(2));
	pNewElem->SetText(3, pOldElem->GetText(3));
	pNewElem->SetText(4, pOldElem->GetText(4));
	pNewElem->SetText(5, _T(""));	
	pNewElem->SetText(6, _T("撤单"));
	pNewElem->SetText(7, strTime.Mid(0, 6));
	pNewElem->SetText(8, strTime.Mid(6,-1));
	pNewElem->SetText(9, _T("123456789"));
	pNewElem->SetText(10, pOldElem->GetText(10));
	
	//send to sdk
	//::PostMessage(GetHWND(), WM_USER_STOCK_ORDER_REQ, (WPARAM)pNewElem, 0L);
	
	OnOrderReq(GetHWND(), (WPARAM)(pNewElem), (LPARAM)(OrderBuy));
}
开发者ID:goodgo,项目名称:TradeClient,代码行数:34,代码来源:StockBuyUI.cpp

示例2: 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();
		}
	}
开发者ID:Crawping,项目名称:IocpServerClient_Side,代码行数:59,代码来源:UIComboBox.cpp

示例3: SendMsg

//name 显示的名字,sText内容
int ChatDialog::SendMsg(CDuiString name,CDuiString sText)
{
  
    CRichEditUI* pRichEdit = static_cast<CRichEditUI*>(paint_manager_.FindControl(kViewRichEditControlName));
    if( pRichEdit == NULL ) 
	{
		DbgPrint("can not find kViewRichEditControlName\n");
		return -1;
	}
	CDuiString strFolder=CPaintManagerUI::GetInstancePath();
    long lSelBegin = 0, lSelEnd = 0;
    CHARFORMAT2 cf;
    ZeroMemory(&cf, sizeof(CHARFORMAT2));
    cf.cbSize = sizeof(cf);
    cf.dwReserved = 0;
    cf.dwMask = CFM_COLOR | CFM_LINK | CFM_UNDERLINE | CFM_UNDERLINETYPE;
    cf.dwEffects = CFE_LINK;
    cf.bUnderlineType = CFU_UNDERLINE;
    cf.crTextColor = RGB(220, 0, 0);

    lSelEnd = lSelBegin = pRichEdit->GetTextLength();
    pRichEdit->SetSel(lSelEnd, lSelEnd);
    pRichEdit->ReplaceSel((LPCTSTR)name, false);

    lSelEnd = pRichEdit->GetTextLength();
    pRichEdit->SetSel(lSelBegin, lSelEnd);
    pRichEdit->SetSelectionCharFormat(cf);

    lSelEnd = lSelBegin = pRichEdit->GetTextLength();
    pRichEdit->SetSel(lSelEnd, lSelEnd);
	CTime time = CTime::GetCurrentTime();
	CDuiString sendTime = time.Format(_T("%H:%M:%S"));
	CDuiString sendtimestr;
	sendtimestr.Format(_T("说:\t%s\n"),sendTime);
	pRichEdit->ReplaceSel(sendtimestr, false);
    //pRichEdit->ReplaceSel(_T("说:\t2011-07-30 08:30:12\n"), false);
    cf.dwMask = CFM_COLOR;
    cf.crTextColor = RGB(0, 0, 0);
    cf.dwEffects = 0;
    lSelEnd = pRichEdit->GetTextLength();
    pRichEdit->SetSel(lSelBegin, lSelEnd);
    pRichEdit->SetSelectionCharFormat(cf);

    PARAFORMAT2 pf;
    ZeroMemory(&pf, sizeof(PARAFORMAT2));
    pf.cbSize = sizeof(pf);
    pf.dwMask = PFM_STARTINDENT;
    pf.dxStartIndent = 0;
    pRichEdit->SetParaFormat(pf);
    lSelEnd = lSelBegin = pRichEdit->GetTextLength();
	//插入字符串,需转移表情
    //pRichEdit->SetSel(-1, -1);
    //pRichEdit->ReplaceSel(sText.GetData(), false);
	pRichEdit->SetSel(-1,-1);
	int m,begin;
	begin=0;
	CDuiString temp;
	char buff[2];
	while(1)
	{
		m=sText.Find(_T("#"),begin);
		if(-1!=m)
		{

			temp=sText.Mid(begin,m-begin);
			pRichEdit->ReplaceSel(temp.GetData(),false);
            int n=sText.Find(_T(".gif"),m);
           //find .gif
			if (n!=-1)
			{
               temp = sText.Mid(m+1,n-m+3);
			   if (frame_wnd_)
			   {
				   CDuiString strfacefolder,strface;
				   strfacefolder.Format(_T("%s\\skin\\Faces\\"),strFolder.GetData());
				   strface.Format(_T("%s\\skin\\Faces\\%s"),strFolder.GetData(),temp.GetData());
				  if (0==frame_wnd_->find_gif_in_folder(temp,strfacefolder))
				  {
                //     pRichEdit->InsertGif(strface);
			
				  }
				  begin=n+4;
				  m=n+4;

			   }
			   else
			   {
				   return 0;
			   }
			}
			else
			{
				pRichEdit->ReplaceSel(temp,false);
				begin=n+1;
			}

		}
		else
		{
//.........这里部分代码省略.........
开发者ID:radtek,项目名称:andy-im,代码行数:101,代码来源:chat_dialog.cpp


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