MCPcopy Create free account
hub / github.com/SOUI2/soui / DrawText

Method DrawText

SOUI/src/control/SCmnCtrl.cpp:24–54  ·  view source on GitHub ↗

///////////////////////////////////////////////////////////////////// Static Control

Source from the content-addressed store, hash-verified

22// Static Control
23//
24void SStatic::DrawText(IRenderTarget *pRT,LPCTSTR pszBuf,int cchText,LPRECT pRect,UINT uFormat)
25{
26 if(!m_bMultiLines)
27 {
28 OnDrawLine(pRT, pszBuf, 0, cchText, pRect, uFormat);
29 }
30 else
31 {
32 if(uFormat&(DT_VCENTER|DT_BOTTOM) && !(uFormat & DT_CALCRECT))
33 {
34 //static 多行控件支持垂直居中及底对齐
35 CRect rcText=*pRect;
36 DrawMultiLine(pRT,pszBuf,cchText,&rcText,uFormat|DT_CALCRECT);
37 CSize szTxt=rcText.Size();
38 rcText = *pRect;
39 switch(GetStyle().GetTextAlign()&(DT_VCENTER|DT_BOTTOM))
40 {
41 case DT_VCENTER:
42 rcText.DeflateRect(0,(rcText.Height()-szTxt.cy)/2);
43 break;
44 case DT_BOTTOM:
45 rcText.DeflateRect(0,(rcText.Height()-szTxt.cy));
46 break;
47 }
48 DrawMultiLine(pRT,pszBuf,cchText,&rcText,uFormat);
49 }else
50 {
51 DrawMultiLine(pRT,pszBuf,cchText,pRect,uFormat);
52 }
53 }
54}
55
56void SStatic::OnDrawLine(IRenderTarget * pRT, LPCTSTR pszBuf, int iBegin, int cchText, LPRECT pRect, UINT uFormat)
57{

Callers 15

DrawItemMethod · 0.45
STabSliderClass · 0.45
DrawYearMonthMethod · 0.45
DrawWeekMethod · 0.45
DrawDayMethod · 0.45
DrawTodayMethod · 0.45
DrawMethod · 0.45
OnPaintMethod · 0.45
OnPaintMethod · 0.45
OnDrawLineMethod · 0.45
OnPaintMethod · 0.45
OnPaintMethod · 0.45

Calls 6

GetStyleFunction · 0.85
DeflateRectMethod · 0.80
SizeMethod · 0.45
GetTextAlignMethod · 0.45
HeightMethod · 0.45
WidthMethod · 0.45

Tested by

no test coverage detected