明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1576|回复: 5

求助:多行文本的字高在程序中如何设置?

[复制链接]
发表于 2005-8-6 10:35:00 | 显示全部楼层 |阅读模式
谢谢啦,等待中
 楼主| 发表于 2005-8-6 11:12:00 | 显示全部楼层
<RE class=Code>Sub Example_AddMtext()
    ' This example creates an MText object in model space.
   
    Dim MTextObj As AcadMText
    Dim corner(0 To 2) As Double
    Dim width As Double
    Dim text As String
    corner(0) = 0#: corner(1) = 10#: corner(2) = 0#
    width = 10
    text = "This is the text String for the mtext Object"

    ' Creates the mtext Object
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)
    ZoomAll
   
End Sub</PRE><RE class=Code>这程序里也没有设置字高的?</PRE>
发表于 2005-8-6 11:12:00 | 显示全部楼层

Sub Example_Height()
    ' This example creates a text object in model space.
    ' It then changes the height of the text object.

    Dim textObj As AcadText
    Dim textString As String
    Dim insertionPoint(0 To 2) As Double
    Dim height As Double
   
    ' Define the text object
    textString = "Hello, World."
    insertionPoint(0) = 3: insertionPoint(1) = 3: insertionPoint(2) = 0
    height = 0.5
   
    ' Create the text object in model space
    Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, height)
    ZoomAll
    MsgBox "The text height is " & textObj.height, vbInformation, "Height Example"
   
    ' Change the value of the Height to 1
    textObj.height = 6
    textObj.Update
    MsgBox "The text height is set to " & textObj.height, vbInformation, "Height Example"
   
End Sub

 楼主| 发表于 2005-8-6 11:21:00 | 显示全部楼层
谢谢大哥回复,你写的是单行文本的高度设置,我现在只能用MTEXT,因为我在做引线标注,引线标注里面只识别多行文本,希望得到解答,多行文本的高度设置?
发表于 2005-8-6 11:34:00 | 显示全部楼层

Sub Example_AddMtext()
    ' This example creates an MText object in model space.
   
    Dim MTextObj As AcadMText
    Dim corner(0 To 2) As Double
    Dim width As Double
    Dim text As String
    corner(0) = 0#: corner(1) = 10#: corner(2) = 0#
    width = 10
    text = "This is the text String for the mtext Object"

    ' Creates the mtext Object
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(corner, width, text)
    MTextObj.Height = 20
    ZoomAll
   
End Sub

 楼主| 发表于 2005-8-6 14:27:00 | 显示全部楼层
好用,谢谢楼上兄台,结帖
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-27 12:46 , Processed in 0.147915 second(s), 29 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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