|
发表于 2008-1-25 15:58:58
|
显示全部楼层
来自: 中国浙江宁波
明细栏和标题栏做成属性块,可以参考下面的语法来获得或修改属性;* T1 ?5 F" N( ~/ U
9 ^% _6 g) @. S! Z4 q0 s
' 获取块参照的属性 ?& g+ ^+ H/ d- {" R% \
Dim varAttributes As Variant % V2 Q- n: e( J. m* Z* Q6 \
varAttributes = blockRefObj.GetAttributes ' 将属性标记和值移至 2 J: x" q: i! L" |. z
' 要在 Msgbox 中显示的字符串中
8 p! m$ x1 y) `1 M5 R7 x" P% P8 TDim strAttributes As String
( M$ H1 {) x6 ?* j& [5 Y! X- lstrAttributes = ""
/ ]) |1 W6 k% G% I1 @: |% dDim I As Integer
$ ]0 Q$ M, e! ~$ ^+ P: AFor I = LBound(varAttributes) To UBound(varAttributes) " S3 z- i, \- Y0 B# [
strAttributes = strAttributes + " Tag: " + varAttributes(I).TagString + vbCrLf + " Value: " + varAttributes(I).textString Next
: ?. d+ M, l8 VMsgBox "The attributes for blockReference " + blockRefObj.Name & " are: " & vbCrLf & strAttributes
; ^0 z) r9 p+ G F: W8 M) f ' 更改属性值 ' 注意:没有 SetAttributes。 一旦包含 ' 变量数组,就拥有了对象。 ' 更改这些对象就会改变图形中的对象。
3 i2 O9 V( a' x q2 h1 T5 B2 ^varAttributes(0).textString = "NEW VALUE!"
3 V4 k& m- }: `' 再次获取属性
3 d+ i0 b7 H9 yDim newvarAttributes As Variant
+ l: q3 _* j2 t' ~5 M4 VnewvarAttributes = blockRefObj.GetAttributes
0 k( v% w. P# {5 d% j9 p" ~' 再次显示标记和值
7 D$ Z! J, k1 `9 n: ]" AstrAttributes = "" 8 I& n5 Z* L) }" }" n
For I = LBound(varAttributes) To UBound(varAttributes)
* V& X6 n; s) D, ]- G* RstrAttributes = strAttributes + " Tag: " + newvarAttributes(I).TagString + vbCrLf + " Value: " + newvarAttributes(I).textString 5 Q8 o2 \! T$ v. Y) T
Next
i: j7 C" P' C9 ?MsgBox "The attributes for blockReference " & blockRefObj.Name & " are: " & vbCrLf & strAttributes
5 j% o. _. u+ h) D* w* l7 b; R( m' L! S: T
[ 本帖最后由 sealive_leafage 于 2008-1-25 16:04 编辑 ] |
评分
-
查看全部评分
|