|
|
发表于 2008-1-25 15:58:58
|
显示全部楼层
来自: 中国浙江宁波
明细栏和标题栏做成属性块,可以参考下面的语法来获得或修改属性;
) r% V+ {1 g0 ]' n2 m; d8 O, m
4 g. i% p* t% k' 获取块参照的属性
& U5 u- t% h/ Z) H; LDim varAttributes As Variant % u% y7 S3 v9 S) r. H6 Y
varAttributes = blockRefObj.GetAttributes ' 将属性标记和值移至
- S2 I% E! m4 a( f' 要在 Msgbox 中显示的字符串中
2 D7 c9 ], b/ Q7 A; X6 Q+ F. }/ n4 SDim strAttributes As String : y7 p# C; Q6 c- P2 C1 Y m
strAttributes = "" 1 q$ [) P/ h. g
Dim I As Integer ; O6 f$ ]7 Y/ X/ M! v
For I = LBound(varAttributes) To UBound(varAttributes) / t# g" t+ |$ v+ g: t
strAttributes = strAttributes + " Tag: " + varAttributes(I).TagString + vbCrLf + " Value: " + varAttributes(I).textString Next 4 |0 ], W7 ]4 Z6 w8 W! g' ?
MsgBox "The attributes for blockReference " + blockRefObj.Name & " are: " & vbCrLf & strAttributes
- T9 W) M, u2 h0 g% O ' 更改属性值 ' 注意:没有 SetAttributes。 一旦包含 ' 变量数组,就拥有了对象。 ' 更改这些对象就会改变图形中的对象。
& P( @5 x7 f, K8 H+ _varAttributes(0).textString = "NEW VALUE!"
* w2 N( L! h; L' 再次获取属性 2 `, m+ h* d7 v9 E7 z) E# l
Dim newvarAttributes As Variant
( W I% O# v; S4 _, p6 F4 ~newvarAttributes = blockRefObj.GetAttributes
- h6 {9 x& ]; K. a; Q) }1 M' I' 再次显示标记和值 * Q+ R: E% s- @/ h! I# Z
strAttributes = ""
9 X; l2 S% ~% G6 C9 GFor I = LBound(varAttributes) To UBound(varAttributes) $ V9 n2 @, I0 g8 s1 W" b
strAttributes = strAttributes + " Tag: " + newvarAttributes(I).TagString + vbCrLf + " Value: " + newvarAttributes(I).textString
2 c; T' n+ o C& M' Y9 Q iNext
' P0 R9 b5 z8 G2 j* ?) d- `0 eMsgBox "The attributes for blockReference " & blockRefObj.Name & " are: " & vbCrLf & strAttributes
' y T( t5 ~ D8 b" U" ?) S& T) t7 ]. y$ w3 {# O% k$ q2 i
[ 本帖最后由 sealive_leafage 于 2008-1-25 16:04 编辑 ] |
评分
-
查看全部评分
|