.net中关于DBText注意事项
需要设置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、文字样式必须有效
作者:yumxuanyi
链接:https://www.jianshu.com/p/53a06b6c60c4
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
|
暂时没有评论
发表评论 - 不要忘了输入验证码哦! |