美文网首页
.net中关于DBText注意事项

.net中关于DBText注意事项

作者: yumxuanyi | 来源:发表于2019-05-23 09:40 被阅读0次
    1. 需要设置AdjustAligment
      参数传入HostApplicationServieces.WorkingDatabase
      且必须放置在最后,否则拖拽前后位置会发生变化。
     DBText text = new DBText();
     text.SetDatabaseDefaults();//设置默认线型 图层等
     text.VerticalMode = TextVerticalMode.TextVerticalMid;//垂直对齐方式
     text.HorizontaiMode = TextHorizontalMode.TextLeft;//水平对齐方式
     text.ColorIndex = 3;//设置文字颜色索引
     text.WidthFactor = 0.65;//设置文字宽度因子
     text.Height = 5; //设置文字高度
     text.TextString = "Hello World"; //设置文本字符串
     text.Position = textPosition;  //设置文字位置 
     text.TextStyleId = textStyleId;//一个非Null的Id
    //下面顺序不要变 否则过拽有问题
     text.AllignmentPoint = textPosition;//设置文字对齐位置
     text.AdjustAlignment(HostApplicationServieces.WorkingDatabase);//设置文字对齐
    

    帮助文档对于AdjustAligment的解释是:
    Normally when a text entity is closed,the text‘s position and allignment points are adjusted according to the text's justification settings and the text style.
    But , if the text entity is embedded in another entity,it will never be closed in wihch case it won't automatically be adjusted.
    Or, if the text is added to a transaction before it's first close(),and the graphics are flushed to the screen before the outemost transaction ends,the text will be displayed before the automatic adjustment takes place.

    1. when this method is called,the database used must be the current working database(as return by HostApplicationServiece()->workingDatabase())
    2. the text entity must have Non-Null text string data ,
    3. and a valid text style objectId that resides in the database being used;
      1. 传入的参数必须是当前活动的数据库
      2. 文本必须为非Null
      3. 文字样式必须有效

    相关文章

      网友评论

          本文标题:.net中关于DBText注意事项

          本文链接:https://www.haomeiwen.com/subject/xxgmzqtx.html