下面是手写板识别文字的代码。怎么才能改变文字的颜色呢?求代码? 20

BOOLCHandWriteX::Recognize(CString&strResult){//Getapointertotheinkstrokecollection//... BOOL CHandWriteX::Recognize(CString& strResult)
{
// Get a pointer to the ink stroke collection
// This collection is a snapshot of the entire ink object
IInkStrokes*pIInkStrokes= NULL ;
HRESULThr= m_pIInkDisp->get_Strokes(&pIInkStrokes) ;
if(SUCCEEDED(hr))
{
// Pass the stroke collection to the recognition context
hr = m_pIInkRecoContext->putref_Strokes(pIInkStrokes) ;
if(SUCCEEDED(hr))
{
// Recognize
IInkRecognitionResult*pIInkRecoResult = NULL ;
InkRecognitionStatusRecognitionStatus ;
//IInkDrawingAttributes* pIInkAttributes = NULL;
//pIInkAttributes->put_Color(RGB(255,222,0));
//add by wangtao
IInkRecognitionAlternates * spIInkRecoAlternates = NULL;
hr = m_pIInkRecoContext->Recognize(&RecognitionStatus, &pIInkRecoResult) ;
if(SUCCEEDED(hr) && (pIInkRecoResult != NULL))
{
// Get the best result of the recognition
BSTRbstrBestResult = NULL ;
//hr = pIInkRecoResult->get_TopString(&bstrBestResult) ;
//pIInkRecoResult->Release() ;
//pIInkRecoResult = NULL ;
//add by wangtao begin
// Get the best lCount results
HRESULT hr;
hr = pIInkRecoResult->AlternatesFromSelection(
0, // in: selection start
-1, // in: selection length; -1 means "up to the last one"
RecognizeLEN, // in: the number of alternates we're interested in
&spIInkRecoAlternates // out: the receiving pointer
);
// Count the returned alternates, it may be less then we asked for
long lCount = 0;
if (SUCCEEDED(hr) && SUCCEEDED(spIInkRecoAlternates->get_Count(&lCount)))
{
// Get the alternate strings
strResult.Empty();
IInkRecognitionAlternate* pIInkRecoAlternate = NULL;
for (LONG iItem = 0; (iItem < lCount) && (iItem < RecognizeLEN); iItem++)
{
// Get the alternate string if there is one
if (SUCCEEDED(spIInkRecoAlternates->Item(iItem, &pIInkRecoAlternate)))
{
BSTR bstr = NULL;
if (SUCCEEDED(pIInkRecoAlternate->get_String(&bstr)))
{
strResult += bstr;
}
pIInkRecoAlternate->Release();
}
}
}

m_pIInkRecoContext->putref_Strokes(NULL) ;
}
pIInkStrokes->Release() ;
}
return SUCCEEDED(hr) ;
}
}
展开
 我来答
匿名用户
2013-03-29
展开全部
单纯从提供的部分代码段初步推断要修改的应该是

//IInkDrawingAttributes* pIInkAttributes = NULL;
//pIInkAttributes->put_Color(RGB(255,222,0));

把这两行前面的 // 去掉编译试试

其中 RGB(255,222,0) 应该就是控制显示的颜色
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式