else if( _tcsicmp(pstrName, _T("valign")) == 0 ) {
if( _tcsstr(pstrValue, _T("top")) != NULL ) {
m_uTextStyle &= ~(DT_BOTTOM | DT_VCENTER | DT_WORDBREAK);
m_uTextStyle |= (DT_TOP | DT_SINGLELINE);
}
if( _tcsstr(pstrValue, _T("vcenter")) != NULL ) {
m_uTextStyle &= ~(DT_TOP | DT_BOTTOM | DT_WORDBREAK);
m_uTextStyle |= (DT_VCENTER | DT_SINGLELINE);
}
if( _tcsstr(pstrValue, _T("bottom")) != NULL ) {
m_uTextStyle &= ~(DT_TOP | DT_VCENTER | DT_WORDBREAK);
m_uTextStyle |= (DT_BOTTOM | DT_SINGLELINE);
}
}
else if( _tcsicmp(pstrName, _T("endellipsis")) == 0 ) {
if( _tcsicmp(pstrValue, _T("true")) == 0 ) m_uTextStyle |= DT_END_ELLIPSIS;
else m_uTextStyle &= ~DT_END_ELLIPSIS;
}
else if( _tcsicmp(pstrName, _T("wordbreak")) == 0 ) {
if( _tcsicmp(pstrValue, _T("true")) == 0 ) {
m_uTextStyle &= ~DT_SINGLELINE;
m_uTextStyle |= DT_WORDBREAK | DT_EDITCONTROL;
}
else {
m_uTextStyle &= ~DT_WORDBREAK & ~DT_EDITCONTROL;
m_uTextStyle |= DT_SINGLELINE;
}
}
duilib 如果先设置换行,再设置valign 属性,换行属性会被覆盖。