MCPcopy Create free account
hub / github.com/cinience/RedisStudio / PaintText

Method PaintText

DuiLib/Control/UILabel.cpp:279–381  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277 }
278
279 void CLabelUI::PaintText(HDC hDC)
280 {
281 if( m_dwTextColor == 0 ) m_dwTextColor = m_pManager->GetDefaultFontColor();
282 if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor();
283
284 RECT rc = m_rcItem;
285 rc.left += m_rcTextPadding.left;
286 rc.right -= m_rcTextPadding.right;
287 rc.top += m_rcTextPadding.top;
288 rc.bottom -= m_rcTextPadding.bottom;
289
290 if(!GetEnabledEffect())
291 {
292 if( m_sText.IsEmpty() ) return;
293 int nLinks = 0;
294 if( IsEnabled() ) {
295 if( m_bShowHtml )
296 CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, m_sText, m_dwTextColor, \
297 NULL, NULL, nLinks, DT_SINGLELINE | m_uTextStyle);
298 else
299 CRenderEngine::DrawText(hDC, m_pManager, rc, m_sText, m_dwTextColor, \
300 m_iFont, DT_SINGLELINE | m_uTextStyle);
301 }
302 else {
303 if( m_bShowHtml )
304 CRenderEngine::DrawHtmlText(hDC, m_pManager, rc, m_sText, m_dwDisabledTextColor, \
305 NULL, NULL, nLinks, DT_SINGLELINE | m_uTextStyle);
306 else
307 CRenderEngine::DrawText(hDC, m_pManager, rc, m_sText, m_dwDisabledTextColor, \
308 m_iFont, DT_SINGLELINE | m_uTextStyle);
309 }
310 }
311 else
312 {
313 Font nFont(hDC,m_pManager->GetFont(GetFont()));
314
315 Graphics nGraphics(hDC);
316 nGraphics.SetTextRenderingHint(m_TextRenderingHintAntiAlias);
317
318 StringFormat format;
319 format.SetAlignment((StringAlignment)m_hAlign);
320 format.SetLineAlignment((StringAlignment)m_vAlign);
321
322 RectF nRc((float)rc.left,(float)rc.top,(float)rc.right-rc.left,(float)rc.bottom-rc.top);
323 RectF nShadowRc = nRc;
324 nShadowRc.X += m_ShadowOffset.X;
325 nShadowRc.Y += m_ShadowOffset.Y;
326
327 int nGradientLength = GetGradientLength();
328
329 if(nGradientLength == 0)
330 nGradientLength = (rc.bottom-rc.top);
331
332 LinearGradientBrush nLineGrBrushA(Point(GetGradientAngle(), 0),Point(0,nGradientLength),_MakeRGB(GetTransShadow(),GetTextShadowColorA()),_MakeRGB(GetTransShadow1(),GetTextShadowColorB() == -1?GetTextShadowColorA():GetTextShadowColorB()));
333 LinearGradientBrush nLineGrBrushB(Point(GetGradientAngle(), 0),Point(0,nGradientLength),_MakeRGB(GetTransText(),GetTextColor()),_MakeRGB(GetTransText1(),GetTextColor1() == -1?GetTextColor():GetTextColor1()));
334
335 if(GetEnabledStroke() && GetStrokeColor() > 0)
336 {

Callers

nothing calls this directly

Calls 8

_MakeRGBFunction · 0.85
GetDefaultFontColorMethod · 0.80
IsEmptyMethod · 0.80
GetFontMethod · 0.45
OffsetMethod · 0.45
GetLengthMethod · 0.45
GetDataMethod · 0.45

Tested by

no test coverage detected