VectorDraw常见问题合集,让你从菜鸡到大神(三)

217 阅读1分钟

    VectorDraw Developer Framework(VDF)是一个用于应用程序可视化的图形引擎库。有了VDF提供的功能,您可以轻松地创建、编辑、管理、输出、输入和打印2D和3D图形文件。   

VectorDraw web library (javascript)不仅能打开CAD图纸,而且能显示任何支持HTML5标准平台上的通用矢量对象,如Windows,安卓,iOS和Linux。无需任何安装,VectorDraw web library (javascript)就可以运行在任何支持canvas标签和Javascript的主流浏览器(Chrome, Firefox, Safari, Opera, Dolphin, Boat等等)中。这意味着可以用DXF,DWG,DGN,SKP(Google的Sketchup),VDML等多种格式在任何台式、平板电脑,智能手机和便携式笔记本上展现出你的业务。

问:

是否存在文档的全局/默认文本高度?当用户想要输入高度值时,它无法用户创建此vdtext时的当前vdtext,用户如何才能在cmdText启动之前设置文本的高度?

答:

此项功能是存在的,想要达到此效果,请参阅以下代码:

        private void button3_Click(object sender, EventArgs e)        {            vdDocument doc = vdFramedControl1.BaseControl.ActiveDocument;            doc.New();            cmdTextWithHeight(doc, null, null, null, 5.0);            cmdTextWithHeight(doc, "VDF version6", new gPoint(30,30), null, 15.0);            cmdTextWithHeight(doc, null, new gPoint(10,10), 0.0d, 25.0);            cmdTextWithHeight(doc, "hi", null, 30.0, 35.0);        }        private bool cmdTextWithHeight(vdDocument document, object TextString, object InsertionPoint, object RotationAngle, double TextHeight)        {            bool ret = false;            double oldheight = document.ActiveTextStyle.Height; // store the old value to set this back after this finishes            document.ActiveTextStyle.Height = TextHeight;// set the Height that is needed to activetextstyle            if (document.CommandAction.CmdText(TextString, InsertionPoint, RotationAngle))            {                vdText txt = document.ActiveLayOut.Entities[document.ActiveLayOut.Entities.Count - 1] as vdText; // get the text that was just created                if (txt != null)                {                    //... do other things there with the just-created-vdText if you like !!                    txt.Height = TextHeight; // see it to the Height so evene if activeTextStyle changes this remains.                    ret = true;                }            }            document.ActiveTextStyle.Height = oldheight; // set the original value back.            return ret;        }