mxGraph图形文本自动换行
来源:互联网 发布:50岁知天命是什么成语 编辑:程序博客网 时间:2024/05/18 01:10
两种方式。
1、直接设置默认样式
style[mxConstants.STYLE_WHITE_SPACE]='wrap'
2、重写mxCellRenderer.prototype.createLabel方法,将其中state.text进行更改,原来的代码如下
state.text = new mxText(value, new mxRectangle(), (state.style[mxConstants.STYLE_ALIGN] || mxConstants.ALIGN_CENTER), graph.getVerticalAlign(state), state.style[mxConstants.STYLE_FONTCOLOR], state.style[mxConstants.STYLE_FONTFAMILY], state.style[mxConstants.STYLE_FONTSIZE], state.style[mxConstants.STYLE_FONTSTYLE], state.style[mxConstants.STYLE_SPACING], state.style[mxConstants.STYLE_SPACING_TOP], state.style[mxConstants.STYLE_SPACING_RIGHT], state.style[mxConstants.STYLE_SPACING_BOTTOM], state.style[mxConstants.STYLE_SPACING_LEFT], state.style[mxConstants.STYLE_HORIZONTAL], state.style[mxConstants.STYLE_LABEL_BACKGROUNDCOLOR], state.style[mxConstants.STYLE_LABEL_BORDERCOLOR], graph.isWrapping(state.cell), graph.isLabelClipped(state.cell), state.style[mxConstants.STYLE_OVERFLOW]);
更改如下
var isWrap = true;state.text = new mxText(value, rectangle, (state.style[mxConstants.STYLE_ALIGN] || mxConstants.ALIGN_CENTER), graph.getVerticalAlign(state), state.style[mxConstants.STYLE_FONTCOLOR], state.style[mxConstants.STYLE_FONTFAMILY], state.style[mxConstants.STYLE_FONTSIZE], state.style[mxConstants.STYLE_FONTSTYLE], 2, 1, 1, 1, 1, true, null, state.style[mxConstants.STYLE_LABEL_BORDERCOLOR], isWrap, graph.isLabelClipped(state.cell), state.style[mxConstants.STYLE_OVERFLOW]);
重写mxCellRenderer.prototype.createLabel方法可以设置label的各种样式。如果对label显示有更多要求,建议重写该方法。直接设置默认样式更为简单。
0 0
- mxGraph图形文本自动换行
- 文本自动换行
- 强制文本自动换行
- 文本自动换行
- 文本自动换行问题
- GridView文本自动换行
- 显示文本自动换行
- j2me文本自动换行
- DIV文本自动换行
- html 文本自动换行
- td文本自动换行
- 文本自动换行
- mxGraph节点图形设置
- 使文本区域内自动换行
- 使用verctor文本自动换行
- [CSS] 文本自动换行设置
- symbian显示文本自动换行
- css设置文本自动换行
- boost 系列五 assign和format
- OJ 1.P
- 一言一行,一路平安,江辰护栏,与您共度一生
- htons函数详解
- 178: ISAM error: Database is locked; pending change to logging mode 解决办法整理
- mxGraph图形文本自动换行
- 此经流年,再次遇见
- Cookie学习笔记二:Cookie实例
- 未雨绸缪
- Excel如何从日期时间中提取年月日时分秒
- OJ 1.Q
- 嵌入式Linux学习小结
- EJB+JPA演示实体类基本操作CRUD的实现
- 老学员衣锦还传智,“浪漫”约会平面小伙伴