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


C++ AString::Text方法代码示例

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


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

示例1: SetText

void AClipboard::SetText(const AString& sText,bool bUnicode /*=true */ )
{
	if(::OpenClipboard(NULL))
	{
		::EmptyClipboard();
		HGLOBAL clipbuffer;
		char *buffer;
		if( bUnicode )
		{
			clipbuffer = ::GlobalAlloc(GMEM_DDESHARE, (sText.Length()+1)*2);
			buffer = (char *)::GlobalLock(clipbuffer);
			wcscpy((wchar_t*)buffer,sText.Text());
			::GlobalUnlock(clipbuffer);
			::SetClipboardData(CF_UNICODETEXT, clipbuffer);
		}
		else
		{
			AString str2;
			str2 = sText;
			const UACHAR* sz = str2.ConvertTo();
			clipbuffer = ::GlobalAlloc(GMEM_DDESHARE, strlen(sz)+1);
			buffer = (char *)::GlobalLock(clipbuffer);
			strcpy(buffer,sz);
			::GlobalUnlock(clipbuffer);
			::SetClipboardData(CF_TEXT, clipbuffer);
		}
		::CloseClipboard();
	}
}
开发者ID:emuikernel,项目名称:BaijieCppUILib,代码行数:29,代码来源:AClipboard.cpp

示例2: DrawText

void ACanvasSkia::DrawText(int x1,int y1,const AString& sText)
{
	//_clip();
	_SetPaint_Font();

	int nFontSize = GetFont()->GetSize();
	y1 += nFontSize;
	//y1 -= 2;//微调 fix me later
	//AString str;
	//str = sText;
// 	AMemory ms;
// 	ms.SetSize( ::WideCharToMultiByte(CP_UTF8,0,sText.Text(),sText.Length(),NULL,0,NULL,NULL) +1 );
// 	char* buf = (char *)ms.GetData();
// 	::WideCharToMultiByte(CP_UTF8,0,sText.Text(),sText.Length(),buf,ms.GetSize()-1,NULL,NULL);
// 	buf[ms.GetSize()-1] = 0;
	const char* sz = (char *)sText.Text();// buf;//str.ConvertTo();
	int iLen = sText.Length()*sizeof(ACHAR);// sz ? strlen(sz) : 0 );

	m_Paint.setTextSize(SkIntToScalar(nFontSize));
	//m_Paint.setSubpixelText(false);
	//m_Paint.setLinearText(true);
	//m_Paint.setHinting(SkPaint::kFull_Hinting);
	m_pCanvas->drawText(sz,iLen,SkIntToScalar(x1),SkIntToScalar(y1),m_Paint);
	
// 	SkPoint pts[1000];
// 	SkScalar xpos = x1;
// 	//SkASSERT(length <= SK_ARRAY_COUNT(pts));
// 	for (size_t i = 0; i < iLen; i++) {
// 		pts[i].set(xpos, y1), xpos += nFontSize;
// 	}
// 	m_pCanvas->drawPosText(sz, iLen, pts, m_Paint);

	Reset();
}
开发者ID:emuikernel,项目名称:BaijieCppUILib,代码行数:34,代码来源:ACanvasSkia.cpp

示例3: DrawText

void GCanvas::DrawText(const ARect& r,const AString& sText,TTextAlign ta)
{
	Flush();

	UINT uFormat=DT_SINGLELINE;
	switch(ta)
	{
	case taLeftTop: uFormat |= DT_LEFT | DT_TOP; break;
	case taCenterTop:uFormat |= DT_CENTER | DT_TOP;break;
	case taRightTop:uFormat |= DT_RIGHT | DT_TOP; break;
	case taLeftMiddle:uFormat |= DT_LEFT | DT_VCENTER;break;
	case taCenterMiddle : uFormat |= DT_CENTER|DT_VCENTER;break;
	case taRightMiddle: uFormat |= DT_RIGHT | DT_VCENTER;break;
	case taLeftBottom: uFormat |= DT_LEFT | DT_BOTTOM; break;
	case taCenterBottom: uFormat |= DT_CENTER | DT_BOTTOM; break;
	case taRightBottom: uFormat |= DT_RIGHT | DT_BOTTOM;break;
	default:break;
	}
	::DrawText(m_hDC,sText.Text(),sText.Length(),(LPRECT)&r,uFormat);
}
开发者ID:emuikernel,项目名称:BaijieCppUILib,代码行数:20,代码来源:GCanvas.cpp

示例4: MeasurePosition

int ACanvasSkia::MeasurePosition(const AString& sText,int iPos)//根据位置找到所在字符串的下标
{
	_SetPaint_Font();
	int iLen = sText.Length();
	ACHAR* s = (ACHAR*)sText.Text();
	int x=0;
	int i=0;
	for(i=0;i<iLen;i++)
	{
		int y = m_Paint.measureText(s,(i+1)*sizeof(ACHAR));
		if( iPos >= x && iPos <= y ) 
		{
			int delta = (y-x)/2;
			if( iPos < x+delta ) return i;
			else return i+1;
		}
		x = y;
	}
	return i;
}
开发者ID:emuikernel,项目名称:BaijieCppUILib,代码行数:20,代码来源:ACanvasSkia.cpp

示例5: MsgBox

int AApplication::MsgBox(const AString& sText,const AString& sCaption,UINT nTyppe)
{
	return ::MessageBox(NULL,sText.Text(),sCaption.Text(),0);
}
开发者ID:emuikernel,项目名称:BaijieCppUILib,代码行数:4,代码来源:AApplication.cpp

示例6: LoadFromFile

void ABitmap::LoadFromFile(const AString& sFileName)
{
	m_Bitmap.Load((LPTSTR)sFileName.Text());
}
开发者ID:emuikernel,项目名称:BaijieCppUILib,代码行数:4,代码来源:ABitmap.cpp

示例7: MeasureText

ASize ACanvasSkia::MeasureText(const AString& sText)
{
	_SetPaint_Font();
	int x = m_Paint.measureText(sText.Text(),sText.Length()*sizeof(ACHAR));
	return ASize(x,GetFont()->GetSize());
}
开发者ID:emuikernel,项目名称:BaijieCppUILib,代码行数:6,代码来源:ACanvasSkia.cpp

示例8: LoadFromFile

void AMyImage::LoadFromFile(const AString& sFileName)
{
	m_Image.Load(sFileName.Text());
	ConvertBits();
	ToTransparent();
}
开发者ID:emuikernel,项目名称:BaijieCppUILib,代码行数:6,代码来源:AMyImage.cpp


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