乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 131|回复: 2

[编程交流] VBA - Add style to Text

[复制链接]

14

主题

28

帖子

14

银币

初露锋芒

Rank: 3Rank: 3Rank: 3

铜币
70
发表于 2022-7-6 21:47:51 | 显示全部楼层 |阅读模式
Hello,
I have this routine to add text in AutoCAD.
I was wondering if I could set the font size, type and color. Could not find any reference to this.
 
Thank you
 
  1. Public Sub AddMyTextHeight(xx, yy, HEIGHT, XC, textString)Dim textObj As AcadTextDim insertionPoint(0 To 2) As DoubleinsertionPoint(0) = xxinsertionPoint(1) = yy insertionPoint(2) = 0Set textObj = ThisDrawing.ModelSpace.AddText(textString, insertionPoint, HEIGHT)textObj.color = XCEnd Sub
回复

使用道具 举报

0

主题

4

帖子

4

银币

初来乍到

Rank: 1

铜币
0
发表于 2022-7-6 22:42:25 | 显示全部楼层
You can assign a style, but not a font.
 
If you setup a style first, like "Arial" using the Arial font - you could do this:
 
  1. textObj.StyleName = "Arial"
 
Font size would be the Height property
 
  1. textObj.Height = 12
 
Color isn't listed as property for AcadText, but I can assign it.  There is also the TrueColor property, using RGB values
 
You can get more information at this AutoDesk page on AcadText for more information.
 
https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2016/ENU/AutoCAD-ActiveX/files/GUID-ED298AC7-19E0-4E54-8983-48439EF70116-htm.html
回复

使用道具 举报

0

主题

946

帖子

978

银币

限制会员

铜币
-3
发表于 2022-7-6 23:07:29 | 显示全部楼层
 
 
Find and open your "acadauto.chm" file. It's invaluable.   
 
Try looking in c:\program files\common files\autodesk shared\  
 
I would attach a copy but i can't upload it
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-3-4 14:40 , Processed in 0.623504 second(s), 58 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表