明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2564|回复: 6

[基础] 单行文字齐的属性

[复制链接]
发表于 2010-12-15 21:30 | 显示全部楼层 |阅读模式
本帖最后由 chpmould 于 2010-12-15 21:33 编辑

请教老师: 单行文字中心对齐属性设置是那个函数(我设置为Center不对,请问应该是什么)
txent.AlignmentPoint = Center;
另外单行文字宽度是那个属性
发表于 2010-12-15 21:46 | 显示全部楼层
DBText.Justify Property
DBText.WidthFactor Property
 楼主| 发表于 2010-12-16 12:30 | 显示全部楼层
请问老师我设置文字以中心对齐这一句(txent.AlignmentPoint = Center;)编译出错,应该如何写这一句,请帮助指正...
发表于 2010-12-16 18:18 | 显示全部楼层
  1.         [CommandMethod("t2")]
  2.         public static void Test2()
  3.         {

  4.             Document doc = Application.DocumentManager.MdiActiveDocument;
  5.             Editor ed = doc.Editor;
  6.             Database db = doc.Database;

  7.             using(var tr = db.TransactionManager.StartTransaction())
  8.             {
  9.                 DBText txt = new DBText();
  10.                 txt.TextString = "ABC";
  11.                 txt.Justify = AttachmentPoint.MiddleCenter;
  12.                 txt.AlignmentPoint = new Point3d(10, 10, 0);
  13.                 txt.SetDatabaseDefaults();
  14.                 var btr = tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite) as BlockTableRecord;
  15.                 AddEntity(tr, btr, txt);
  16.                 tr.Commit();
  17.             }

  18.         }
 楼主| 发表于 2010-12-16 19:31 | 显示全部楼层
谢谢老师的指点,问题已解决。。。
另外再请教一下单行文字角度是那个属性?
发表于 2010-12-16 20:57 | 显示全部楼层
这个在文档很容易就查到的
最好的老师是帮助啊
Autodesk.AutoCAD.DatabaseServices Namespace > DBText Class > DBText Properties > DBText.Rotation Property
DBText.Rotation Property
Collapse AllC#
[UnitType(Autodesk.AutoCAD.DatabaseServices.UnitType.Angle), Category("Text")]
public double Rotation;
Visual Basic
<UnitType(Autodesk.AutoCAD.DatabaseServices.UnitType.Angle), Category("Text")>
Public Property Rotation() As double
Description


Accesses the rotation angle of the text. The rotation angle is relative to the X axis of the text's OCS, with positive angles going counterclockwise when looking down the Z axis towards the origin. The OCS X axis is determined by using the text's normal, the WCS Z axis, and the arbitrary axis algorithm.

Conditions
Read / Write

Links
DBText Class, Autodesk.AutoCAD.DatabaseServices Namespace
 楼主| 发表于 2010-12-17 12:31 | 显示全部楼层
谢谢老师提供的帮助,我英文差,看的似懂非懂...
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-17 13:05 , Processed in 0.161275 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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