明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1891|回复: 3

如何改变单行文字的字体样式?

[复制链接]
发表于 2006-6-5 15:35:00 | 显示全部楼层 |阅读模式

object.stylename=anotherstyle(or anotherstyle.name)?

但编译时老说方法不对

发表于 2006-6-5 16:19:00 | 显示全部楼层

object.stylename="STANDARD"

 

 楼主| 发表于 2006-6-5 20:07:00 | 显示全部楼层

是样式名称?但新建了“样式1”,然后改为object.stylename="样式1",还是不行。

发表于 2006-6-6 08:54:00 | 显示全部楼层

应该是没问题的,下面这个是VBA上的例子,你参考一下。。。

Sub Example_StyleName()
    ' This example creates an aligned dimension and then changes the
    ' StyleName property for that dimension.

    Dim dimObj As AcadDimAligned
    Dim point1(0 To 2) As Double
    Dim point2(0 To 2) As Double
    Dim location(0 To 2) As Double
    Dim currStyleName As String
    
    ' Define the dimension
    point1(0) = 5#: point1(1) = 3#: point1(2) = 0#
    point2(0) = 10#: point2(1) = 3#: point2(2) = 0#
    location(0) = 7.5: location(1) = 5#: location(2) = 0#

    ' Create an aligned dimension object in model space
    Set dimObj = ThisDrawing.ModelSpace.AddDimAligned(point1, point2, location)
    ZoomAll
    currStyleName = dimObj.styleName
    MsgBox "The initial StyleName for the dimension is " & dimObj.styleName, vbInformation, "TextString Example"
    
    ' Create a new dimension style
    ThisDrawing.DimStyles.Add ("NewDimensionStyle")
    
    ' Change the text string for the dimension
    dimObj.styleName = "NewDimensionStyle"
    dimObj.Update
    MsgBox "The new StyleName for the dimension is " & dimObj.styleName, vbInformation, "TextString Example"
    
    ' Reset the text string for the dimension
    dimObj.styleName = currStyleName
    dimObj.Update
    MsgBox "The StyleName for the dimension has been reset to " & dimObj.styleName, vbInformation, "TextString Example"
End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-27 02:41 , Processed in 0.161710 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表