|
发表于 2008-1-25 15:58:58
|
显示全部楼层
来自: 中国浙江宁波
明细栏和标题栏做成属性块,可以参考下面的语法来获得或修改属性;+ C) c( k& W- f! e2 f) |7 {5 a
% q A: F; y9 J9 `5 j, j' 获取块参照的属性 6 Z5 \% ]! h0 S( K
Dim varAttributes As Variant
\- H# T- A, T% ^/ l. `varAttributes = blockRefObj.GetAttributes ' 将属性标记和值移至 - Q) I1 z$ V, J" s9 e; H
' 要在 Msgbox 中显示的字符串中
X5 L- j# B5 m5 N3 c. R7 lDim strAttributes As String 4 d& H+ Y- |; I
strAttributes = "" # X) ^/ d4 R5 } N$ o% ~, y
Dim I As Integer , R* L+ [- ]! t
For I = LBound(varAttributes) To UBound(varAttributes)
) ^/ w! k" H* MstrAttributes = strAttributes + " Tag: " + varAttributes(I).TagString + vbCrLf + " Value: " + varAttributes(I).textString Next
3 N3 p8 o* I @7 i( i# QMsgBox "The attributes for blockReference " + blockRefObj.Name & " are: " & vbCrLf & strAttributes & S8 P- X* s7 r, O( \
' 更改属性值 ' 注意:没有 SetAttributes。 一旦包含 ' 变量数组,就拥有了对象。 ' 更改这些对象就会改变图形中的对象。
$ c8 K' U# d" n6 b' f7 \" FvarAttributes(0).textString = "NEW VALUE!" $ d, C* i! n& N
' 再次获取属性
+ V* u5 Q- N$ a8 S% K) @2 A$ rDim newvarAttributes As Variant
( E% p7 G: ?" `! Z W- l/ D3 _newvarAttributes = blockRefObj.GetAttributes
$ j( d% r9 F6 ], j/ I. a) Q' 再次显示标记和值
+ b- G, [4 u# R4 WstrAttributes = "" 6 m* t" R! I8 L4 g* C
For I = LBound(varAttributes) To UBound(varAttributes)
! V) s1 C7 @. V6 v9 SstrAttributes = strAttributes + " Tag: " + newvarAttributes(I).TagString + vbCrLf + " Value: " + newvarAttributes(I).textString
2 u- G4 H) Y0 G! _8 _) z0 yNext ! c1 G" j8 O; X i2 N+ o
MsgBox "The attributes for blockReference " & blockRefObj.Name & " are: " & vbCrLf & strAttributes
- C& h& P9 u4 w8 F' u7 F2 f' Z3 W4 ^
[ 本帖最后由 sealive_leafage 于 2008-1-25 16:04 编辑 ] |
评分
-
查看全部评分
|