The style of the box that i using is tsFitPolyCenter
I put the code of my program bellow to show how i creating the boxes.
//principal box // Criação do box. BoxItem box = CreateBox(nX, nY, nWidth, nHeight); GroupItem g = CreateGroup(box); box.SetShape(m_shapeRetangular); box.SetCustomDraw(cdAdditional); box.SetConstraints(ncMoveDirection, 1); box.SetLocked(false); box.SetMnpHandlesMask(0x1FF); AddTextos(box, strTexto, _T(""));
//internal boxes
// Add text in the internal box void AddText(BoxItem box, CString texto1, CString texto2) { long width = box.GetRight() - box.GetLeft(); long height = box.GetBottom() - box.GetTop(); BoxItem t1, t2, line;
t1 = this->CreateBox(box.GetLeft(), box.GetTop(), width, height/2); t2 = this->CreateBox(box.GetLeft()+1, box.GetTop()+(height/2)+1, width-1, (height/2)-1); if (box.GetShape() == m_shapeRetangular) { t1.SetShape(GetShapes(_variant_t("Rectangle"))); t2.SetShape(GetShapes(_variant_t("Rectangle"))); } else if (box.GetShape() == m_shapeOval) { t1.SetShape(m_shapeMeiaLuaCima); t2.SetShape(m_shapeMeiaLuaBaixo); }
// Texto 1 t1.SetStyle(bsShape); t1.SetTextStyle(tsFitPolyCenter); t1.SetTextColor(RGB(0,0,0)); t1.SetText(texto1); t1.SetTransparent(true); t1.SetLocked(true); t1.SetTag(tagDescricaoSucinta); t1.FitSizeToText();
CY fsize; fsize.int64 = 80000;
CFontHolder fh1(NULL); fh1.InitializeFont(); t1.SetFont((LPDISPATCH)fh1.m_pFont); t1.GetFont().SetSize(fsize); t1.GetFont().SetName(_T("Arial"));
// Texto 2 t2.SetStyle(bsShape); t2.SetTextStyle(tsFitPolyCenter); t2.SetText(texto2); t2.SetTransparent(true); t2.SetLocked(true); t2.SetTag(tagEspecificacao);
CFontHolder fh2(NULL); fh2.InitializeFont(); t2.SetFont((LPDISPATCH)fh2.m_pFont); t2.GetFont().SetSize(fsize); t2.GetFont().SetName(_T("Arial"));
GroupItem g = box.GetSubordinateGroup(); g.AttachProportional(t1,0,0,100,50); g.AttachProportional(t2,0,50,100,100); }
|