如何解决如何以编程方式更改 PowerDesigner 16 PDM 图中列的颜色
我可以使用 VBA 循环遍历表的列并更改与 Column 对象本身相关的许多属性。我正在寻找的是更改 PDM 图中显示的表的选择列的颜色。可以从 UI 执行此操作,方法是单击表格的列以在图表中选择它,然后右键单击以显示上下文菜单,然后选择“子对象格式”。
解决方法
这是一个示例,它使用一些任意条件将物理数据模型中的某些列写成红色,当它们的名称包含“b”时...使用 ObjectCompositeSymbol.SubObjects
属性。
option explicit
const workfont = "Arial,8,N,255,0"
dim diags: set diags = createobject("Scripting.Dictionary")
dim m : set m = activemodel
dim t
for each t in m.tables
' public name of subobjects: Column; 0: display all
dim sb : sb = "Column 0" + vbcrlf
dim c,some : some = false
for each c in t.columns
' our criteria is: column name contains a b
dim match : match = instr(lcase(c.name),"b") <> 0
if match then
sb = sb + "{"+ c.GetAttribute("ObjectID")+"} " + workfont + vbcrlf
some = true
end if
next
if not some then sb = ""
' apply subobjects coloring
dim s
for each s in t.symbols
if s.subobjects <> sb then
s.subobjects = sb
if not diags.exists(s.diagram) then diags.add s.diagram,0
end if
next
next
if diags.count > 0 then
dim d
for each d in diags.keys
output "... redraw "+d.name
d.RedrawAllViews
next
end if
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。