在网页中如何绘制文字自动居中的标注?
MxDraw网页开发|冯美娟|2019-06-11 10:03
-
回答:
var MxDrawDatabase1 = mxOcx.GetDatabase(); MxDrawDatabase1.LinetypeScale = 15; var curDimRecord = MxDrawDatabase1.GetDimStyleTable().GetAt(MxDrawDatabase1.CurrentlyDimstyleName, false); var curTextRecord = MxDrawDatabase1.GetTextStyleTable().GetAt(MxDrawDatabase1.CurrentlyTextStyle, false); curDimRecord.SetDimVarDouble(40, 1000);//设置缩放比例Dimscale curDimRecord.SetDimVarInt(271, 0);//设置两位小数DimDle curDimRecord.SetDimVarInt(173, 1); //设置需要显示符号 curDimRecord.SetDimVarInt(289, 3); curDimRecord.SetDimVarInt(174, 1); curDimRecord.SetDimVarString(342, "_ARCHTICK"); //设置建筑标记 curTextRecord.bigFontFileName = "gbcbig.shx"; curTextRecord.fileName = "tssdeng.shx"; curTextRecord.Name = "默认样式"; var dimID = mxOcx.DrawDimRotated(100, 100, 100, 200, 200, 150, 0); var Dim = mxOcx.ObjectIdToObject(dimID); Dim.DimensionText = "12345"; Dim.SetDimVarInt(173, 1); //设置需要显示符号 Dim.SetDimVarInt(289, 0); Dim.SetDimVarInt(174, 1); Dim.SetDimVarString(342, "_ARCHTICK"); //设置建筑标记 var textPos = mxOcx.NewPoint(); textPos.x = 200; textPos.y = 150; Dim.TextPosition = textPos; Dim.UsingDefaultTextPosition = false; Dim.RecomputeDimBlock(true); mxOcx.UpdateDisplay(); mxOcx.ZoomAll();