|
|
发表于 2008-1-25 15:58:58
|
显示全部楼层
来自: 中国浙江宁波
明细栏和标题栏做成属性块,可以参考下面的语法来获得或修改属性;" J2 m$ T" ]- } F$ e& S9 `
( C- u: Y9 M2 x5 m0 B; G4 v8 l+ l2 `# l
' 获取块参照的属性
& t: Y+ N: l+ V" E$ ?Dim varAttributes As Variant $ B$ b6 }6 b6 r
varAttributes = blockRefObj.GetAttributes ' 将属性标记和值移至 % E( H: u& Z5 P) W; {* ]( D
' 要在 Msgbox 中显示的字符串中
" L' C, s; R9 r+ r* E: n/ qDim strAttributes As String
( \+ z3 ]2 f$ }9 i& k) C% U3 W; \strAttributes = ""
, p' L& f H* I5 @. RDim I As Integer
5 g/ O7 @: P* T! zFor I = LBound(varAttributes) To UBound(varAttributes) : ^$ t+ o' c# K4 N* A% m+ f
strAttributes = strAttributes + " Tag: " + varAttributes(I).TagString + vbCrLf + " Value: " + varAttributes(I).textString Next
8 X6 ^1 v4 q; w& z" BMsgBox "The attributes for blockReference " + blockRefObj.Name & " are: " & vbCrLf & strAttributes * `8 p/ f. k' a/ Y
' 更改属性值 ' 注意:没有 SetAttributes。 一旦包含 ' 变量数组,就拥有了对象。 ' 更改这些对象就会改变图形中的对象。 Y5 [. `. ^" f* v, `
varAttributes(0).textString = "NEW VALUE!"
, ~: S& `3 u5 I" v' 再次获取属性
# d; r t- @9 G8 k( [" ~& B# LDim newvarAttributes As Variant ' v c- G6 p& u; E# H8 l; t
newvarAttributes = blockRefObj.GetAttributes # O/ r6 K8 [, R2 J, p6 G& a
' 再次显示标记和值
- F7 E, @6 e. k! t, m. _strAttributes = ""
7 j0 E5 ]0 l) U2 w) A9 c! a( t) BFor I = LBound(varAttributes) To UBound(varAttributes) 7 _# h+ I" b1 h% m. E4 X: x A. @
strAttributes = strAttributes + " Tag: " + newvarAttributes(I).TagString + vbCrLf + " Value: " + newvarAttributes(I).textString 1 U6 {/ O. F/ j
Next 4 _+ p, M$ B U/ K; E9 P
MsgBox "The attributes for blockReference " & blockRefObj.Name & " are: " & vbCrLf & strAttributes N% Q$ S* {# Y6 [
, h! n) D6 P U* R) o0 L
[ 本帖最后由 sealive_leafage 于 2008-1-25 16:04 编辑 ] |
评分
-
查看全部评分
|