以前用ArcGIS Label一般也就在图层的Properties里面定义一下Label字体大小和粗细。这两天遇到一个问题,需要在Label中显示多个字段的内容,比如BlockName和CompanyName。其实这个本来不是很难的问题,因为Label中支持VBScript,使用[BlockName] & VbNewLine & [CompanyName]。就可以实现标注中第一行显示BlockName,第二行显示CompanyName.
现在问题出来了,出图时候希望突出BlockName效果,希望加粗显示,而CompanyName使用一般字体。考虑了很长时间终于从ArcGIS帮助中找到了相关的内容,原来Label的VBScript里面支持类似于Html的VBScript标签,比如加粗就是用<BOL>,上面问题就可以使用下面语句解决:
"<BOL>" & [BlockName] & "</BOL>" & VbNewLine & [CompanyName]
除了加粗,ArcGIS中还支持下面的文本格式标签:
Font:字体
"<FNT name='Arial' size='18'>" & [LABELFIELD] & "</FNT>"
Color:颜色
"<CLR red='255' green='255' blue='255'>" & [LABELFIELD] & "</CLR>"
"<CLR cyan='100' magenta ='100' yellow='100' black='100'>" & [LABELFIELD] & "</CLR>"
Bold:加粗
"<BOL>" & [LABELFIELD] & "</BOL>"
Italic:斜体
"<ITA>" & [LABELFIELD] & "</ITA>"
Underline:下划线
"<UND>" & [LABELFIELD] & "</UND>"
All caps:
"<ACP>" & [LABELFIELD] & "</ACP>"
Small caps:
"<SCP>" & [LABELFIELD] & "</SCP>"
Superscript上标
"<SUP>" & [LABELFIELD] & "</SUP>"
Subscript:下标
"<SUB>" & [LABELFIELD] & "</SUB>"
Character spacing (%):
"<CHR spacing='25'>" & [LABELFIELD] & "</CHR>"
Word spacing (%):
"<WRD spacing='150'>" & [LABELFIELD] & "</WRD>"
Leading (pts):
"<LIN leading='12'>" & [LABELFIELD] & "</LIN
盗用大王的文章,自己留着用。
来源:https://www.cnblogs.com/WSS479218170/p/5650931.html