[prostructuresCE C++ 二次开发]应用文字样式失败

老师,我用如下代码创建一个文本,设置样式为CGNRebarGrade,最后文本样式不是这个文本样式。我查看了textstyle,该文本样式未激活,请问是由于这个原因造成的吗?需要怎么激活该样式使其应用成功

void CreateRoomNameTool::GetNameWideAndHeight(double& wide, double& height, TextBlockPtr& textblockPtr)
{

	DgnModelP   pActiveModel=ISessionMgr::GetActiveDgnModelP();
	DgnTextStylePtr pTextStyle = DgnTextStyle::GetByName(L"CGNRebarGrade", StyleIteratorMode::ActiveFileAndLibraries);
	RunPropertiesPtr pRunProp = RunProperties::Create(*pTextStyle, *pActiveModel);
	pRunProp->SetColor(1);
	Dpoint2d frontsize = pRunProp->GetFontSize();
	TextBlockPropertiesPtr pTBProp = TextBlockProperties::Create(*pActiveModel);
	ParagraphPropertiesPtr pParaProp = ParagraphProperties::Create(*pActiveModel);
	textblockPtr = TextBlock::Create(*pTBProp, *pParaProp, *pRunProp, *pActiveModel);
	textblockPtr->AppendText(g_roomNameInfo.wchRoomName); 
	DRange3d drange = textblockPtr->GetNominalRange();
	height = drange.YLength() +40 * UOR_PER_MM;
	wide = drange.XLength();
}

Parents Reply Children
No Data