windows客户端开发--duilib显示html
来源:互联网 发布:mac安装磁盘被锁定 编辑:程序博客网 时间:2024/05/16 16:18
今天与大家分享的就是duilib这个库中,如何做到显示html的。
有些控件,如Text可以通过showhtml函数来设置是否显示html富文本。
加粗
{b}加粗{/b}
斜体
{i}斜体{/i}
下划线
{u}下划线{/u}
被选中
{s}被选中{/s}
换行
{n}
链接
这个是最重要的 个人觉得。
{a http://www.baidu.com}百度{/a>}
例如:
输入 www.baidu.com {n} {b}加粗{/b} {n} {i}斜体{/i}{n} {u}下划线{/u} {n} {s}被选中{/s}
显示:
最后贴一段duilib中如何处理link的代码:
case _T('a'): // Link { pstrText++; while( *pstrText > _T('\0') && *pstrText <= _T(' ') ) pstrText = ::CharNext(pstrText); if( iLinkIndex < nLinkRects && !bLineDraw ) { CDuiString *pStr = (CDuiString*)(sLinks + iLinkIndex); pStr->Empty(); while( *pstrText != _T('\0') && *pstrText != _T('>') && *pstrText != _T('}') ) { LPCTSTR pstrTemp = ::CharNext(pstrText); while( pstrText < pstrTemp) { *pStr += *pstrText++; } } } DWORD clrColor = pManager->GetDefaultLinkFontColor(); if( bHoverLink && iLinkIndex < nLinkRects ) { CDuiString *pStr = (CDuiString*)(sLinks + iLinkIndex); if( sHoverLink == *pStr ) clrColor = pManager->GetDefaultLinkHoverFontColor(); } //else if( prcLinks == NULL ) { // if( ::PtInRect(&rc, ptMouse) ) // clrColor = pManager->GetDefaultLinkHoverFontColor(); //} aColorArray.Add((LPVOID)clrColor); ::SetTextColor(hDC, RGB(GetBValue(clrColor), GetGValue(clrColor), GetRValue(clrColor))); TFontInfo* pFontInfo = pManager->GetDefaultFontInfo(); if( aFontArray.GetSize() > 0 ) pFontInfo = (TFontInfo*)aFontArray.GetAt(aFontArray.GetSize() - 1); if( pFontInfo->bUnderline == false ) { HFONT hFont = pManager->GetFont(pFontInfo->sFontName, pFontInfo->iSize, pFontInfo->bBold, false, pFontInfo->bItalic); if( hFont == NULL ) { hFont = pManager->AddFont(g_iFontID, pFontInfo->sFontName, pFontInfo->iSize, pFontInfo->bBold, false, pFontInfo->bItalic); g_iFontID += 1; } pFontInfo = pManager->GetFontInfo(hFont); aFontArray.Add(pFontInfo); pTm = &pFontInfo->tm; ::SelectObject(hDC, pFontInfo->hFont); cyLine = MAX(cyLine, pTm->tmHeight + pTm->tmExternalLeading + (int)aPIndentArray.GetAt(aPIndentArray.GetSize() - 1)); } ptLinkStart = pt; bInLink = true; } break;
0 0
- windows客户端开发--duilib显示html
- DuiLib开发之显示Gif
- DuiLib开发之显示Gif
- windows下duilib库开发001
- 在DuiLib开发的客户端里面使用CEF
- 在DuiLib开发的客户端里面使用CEF
- DuiLib属性--使用html
- OSG+Duilib显示osg
- windows客户端开发--如何测量一个字符串显示的物理长度
- Windows客户端开发--使用控制台窗口显示调试信息(打log)
- windows客户端开发调试工具
- windows客户端开发调试工具
- windows客户端开发调试工具
- Windows客户端开发技能树
- duilib的界面开发
- windows客户端开发--windows api大全
- windows客户端开发--windows api大全
- windows客户端开发--windows api大全
- 海量数据处理问题
- 每日一bootstrap 表单
- 态度
- Android-改变文字颜色的上下文菜单
- 拒绝被坑 超实用的移动电源选购技巧 分享给大家
- windows客户端开发--duilib显示html
- Java多线程安全问题及解决方案
- Oulipo (HDU_1686) KMP
- 动态HTML和W3C文档对象模型
- 精简ID号码
- 特征提取算法--Surf
- 数据结构(12)线性表之C++实现一元多项式相加
- 添加Push失败!(与alias对应的device_tokens为空)
- UESTC 1146 秋实大哥与连锁快餐店 最小生成树、Prim