TextContainer::TextContainer(int textSize, int width, int height){ //определить _size, _length, _inset //инициализируем шрифты _fonts = TTF_OpenFont("fonts/ARIAL.TTF", textSize); if (!_fonts){ cout << "не нашел шрифты" << endl; } _width = width; _height = height; _textSize = textSize; lengthCalc(); sizeCalc(); }
static void _message(S_SCR_INFO *psSI,BOOL bClear,CHAR *lpMessage) { HDC hdc; RECT rWin; SIZE sWin; HFONT hFont,hFontOld=NULL; RECT rText; SIZE sText; hdc=GetDC(psSI->ObjClient->hWnd); GetWindowRect(psSI->ObjClient->hWnd,&rWin); sWin.cx=rWin.right-rWin.left+1; sWin.cy=rWin.bottom-rWin.top+1; sText.cx=180; sText.cy=50; // Larghezza ed altezza del rettangolo rText.left=(sWin.cx-sText.cx)/2; rText.right=rText.left+sText.cx+1; rText.top=(sWin.cy-sText.cy)/2; rText.bottom=rText.top+sText.cy+1; if (bClear) { RECT rArea; _(rArea); rArea.right=sWin.cx-1; rArea.bottom=sWin.cy-1; dcBoxBrush(hdc,&rArea,HS_BDIAGONAL,sys.Color3DShadow,sys.Color3DLight); /* RECT rArea; // HBRUSH backBrush=CreateSolidBrush(sys.Color3DShadow); HBRUSH diagBrush=CreateHatchBrush(HS_BDIAGONAL,sys.Color3DLight); SetBkColor(hdc,sys.Color3DShadow); _(rArea); rArea.right=sWin.cx-1; rArea.bottom=sWin.cy-1; // FillRect(hdc, &rArea, backBrush); FillRect(hdc, &rArea, diagBrush); // DeleteObject(backBrush); DeleteObject(diagBrush); */ } if (!strEmpty(lpMessage)) { RECT rcText; SIZE sCalc; SetBkMode(hdc,OPAQUE); SetBkColor(hdc,RGB(255,255,255)); SetTextColor(hdc,RGB(120,120,120)); hFont=GetStockObject(SYSTEM_FONT); hFontOld = SelectObject(hdc, hFont); dcRectRound(hdc,&rText,ColorLum(sys.Color3DShadow,-20),RGB(255,255,255),24,24,3); _(rcText); DrawText(hdc, lpMessage,strlen(lpMessage), &rcText, // pointer to struct with formatting dimensions DT_CALCRECT// text-drawing flags ); sizeCalc(&sCalc,&rcText); //rText.left rText.left+=2; rText.top+=(sText.cy-sCalc.cy)>>1; //rText.right //rText.right-=2; rText.bottom-=2; DrawText(hdc, lpMessage, strlen(lpMessage), &rText, // pointer to struct with formatting dimensions DT_CENTER|DT_VCENTER// text-drawing flags ); }
void TextContainer::setPadding(size_t padding_top, size_t padding_lr){ _padding_lr = padding_lr; _padding_top = padding_top; lengthCalc(); sizeCalc(); }