///////////////////////////////////////////////////////////////////// Static Control
| 22 | // Static Control |
| 23 | // |
| 24 | void 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 | |
| 56 | void SStatic::OnDrawLine(IRenderTarget * pRT, LPCTSTR pszBuf, int iBegin, int cchText, LPRECT pRect, UINT uFormat) |
| 57 | { |
no test coverage detected