he993 发表于 2006-6-5 15:35:00

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

<P>object.stylename=anotherstyle(or anotherstyle.name)?</P>
<P>但编译时老说方法不对</P>

xinghesnak 发表于 2006-6-5 16:19:00

<P>object.stylename="STANDARD"</P>
<P>&nbsp;</P>

he993 发表于 2006-6-5 20:07:00

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

xinghesnak 发表于 2006-6-6 08:54:00

<P>应该是没问题的,下面这个是VBA上的例子,你参考一下。。。</P><PRE class=Code>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 " &amp; 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 " &amp; 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 " &amp; dimObj.styleName, vbInformation, "TextString Example"
End Sub</PRE>
页: [1]
查看完整版本: 如何改变单行文字的字体样式?