UICommonControls.cpp ( 文件浏览 )
- keepall 发布于 2016-08-23 13:24
- 浏览次数:345
- 下载次数: 1
- 下载需 20 积分
-
- 侵权举报
#include "StdAfx.h" namespace DuiLib { ///////////////////////////////////////////////////////////////////////////////////// // // CLabelUI::CLabelUI() : m_uTextStyle(DT_VCENTER), m_dwTextColor(0), m_dwDisabledTextColor(0), m_iFont(-1), m_bShowHtml(false) { ::ZeroMemory(&m_rcTextPadding, sizeof(m_rcTextPadding)); } LPCTSTR CLabelUI::GetClass() const { return _T("LabelUI"); } LPVOID CLabelUI::GetInterface(LPCTSTR pstrName) { if( _tcscmp(pstrName, _T("Label")) == 0 ) return static_cast<CLabelUI*>(this); return CControlUI::GetInterface(pstrName); } void CLabelUI::SetTextStyle(UINT uStyle) { m_uTextStyle = uStyle; Invalidate(); } UINT CLabelUI::GetTextStyle() const { return m_uTextStyle; } void CLabelUI::SetTextColor(DWORD dwTextColor) { m_dwTextColor = dwTextColor; } DWORD CLabelUI::GetTextColor() const { return m_dwTextColor; } void CLabelUI::SetDisabledTextColor(DWORD dwTextColor) { m_dwDisabledTextColor = dwTextColor; } DWORD CLabelUI::GetDisabledTextColor() const { return m_dwDisabledTextColor; } void CLabelUI::SetFont(int index) { m_iFont = index; } int CLabelUI::GetFont() const { return m_iFont; } RECT CLabelUI::GetTextPadding() const { return m_rcTextPadding; } void CLabelUI::SetTextPadding(RECT rc) { m_rcTextPadding = rc; Invalidate(); } bool CLabelUI::IsShowHtml() { return m_bShowHtml; } void CLabelUI::SetShowHtml(bool bShowHtml) { if( m_bShowHtml == bShowHtml ) return; m_bShowHtml = bShowHtml; Invalidate(); } SIZE CLabelUI::EstimateSize(SIZE szAvailable) { if( m_cxyFixed.cy == 0 ) return CSize(m_cxyFixed.cx, m_pManager->GetDefaultFontInfo()->tm.tmHeight + 4); return CControlUI::EstimateSize(szAvailable); } void CLabelUI::DoEvent(TEventUI& event) { if( event.Type == UIEVENT_SETFOCUS ) { m_bFocused = true; return; } if( event.Type == UIEVENT_KILLFOCUS ) { m_bFocused = false; return; } if( event.Type == UIEVENT_MOUSEENTER ) { return; } if( event.Type == UIEVENT_MOUSELEAVE ) { return; } CControlUI::DoEvent(event); } void CLabelUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue) { if( _tcscmp(pstrName, _T("align")) == 0 ) { if( _tcsstr(pstrValue, _T("left")) != NULL ) { m_uTextStyle &= ~(DT_CENTER | DT_RIGHT | DT_TOP | DT_BOTTOM); m_uTextStyle |= DT_LEFT; } if( _tcsstr(pstrValue, _T("center")) != NULL ) { m_uTextStyle &= ~(DT_LEFT | DT_RIGHT | DT_TOP | DT_BOTTOM); m_uTextStyle |= DT_CENTER; } if( _tcsstr(pstrValue, _T("right")) != NULL ) { m_uTextStyle &= ~(DT_LEFT | DT_CENTER | DT_TOP | DT_BOTTOM); m_uTextStyle |= DT_RIGHT; } if( _tcsstr(pstrValue, _T("top")) != NULL ) { m_uTextStyl[!==More==!]
...
展开> <收缩
Sponsored links
源码文件列表
温馨提示: 点击源码文件名可预览文件内容哦 ^_^ Sponsored links