新手入门必看:VectorDraw 常见问题整理大全(八)
VectorDraw Developer Framework(VDF)是一个用于应用程序可视化的图形引擎库。有了VDF提供的功能,您可以轻松地创建、编辑、管理、输出、输入和打印2D和3D图形文件。该库还支持许多矢量和栅格输入和输出格式,包括本地PDF和SVG导出。
【VectorDraw Developer Framework最新版下载】
VectorDraw web library (javascript)是一个矢量图形库。VectorDraw web library (javascript)不仅能打开CAD图纸,而且能显示任何支持HTML5标准平台上的通用矢量对象,如Windows,安卓,iOS和Linux。无需任何安装,VectorDraw web library (javascript)就可以运行在任何支持canvas标签和Javascript的主流浏览器(Chrome, Firefox, Safari, Opera, Dolphin, Boat等等)中。
【VectorDraw web library (javascript)最新版下载】
一. 已编译的项目无法与安装的其他VDF版本一起使用
问:我创建了一个使用VectorDraw控件6009编译的简单应用程序。所有VectorDraw dll引用都是使用Specific Version = false和Copy Local = false编译的。此应用程序仅适用于具有VectorDraw 6009的计算机,如果它在VectorDraw 6011计算机上运行则抛出异常。在项目中,我不使用6011中但在6009中丢失或更改的任何属性/方法/事件?
答:注意:不建议使用以下解决方案。我们建议使用相同的VDF版本构建和重新分发您的应用程序。
您可以通过分发配置文件来重定向VectorDraw dll的版本。
对于VectorDraw程序集dll,配置文件必须如下所示。此外,它必须与您的应用程序.exe放在同一目录中,并且必须使用格式重命名(yourapplicationname.exe.config)
此配置文件将使用6.1.6011.0重定向所有版本的VectorDraw程序集(请注意,这些dll必须存在于分发计算机中)
<?xml version =“1.0”?> <configuration> <runtime> <assemblyBinding xmlns =“urn:schemas-microsoft-com:asm.v1”> <dependentAssembly> <assemblyIdentity name =“VectorDraw.Actions”publicKeyToken =“54eac14e23c9ee53 “culture =”neutral“/> <bindingRedirect oldVersion =”0.0.0.0-6.1.65535.65535“newVersion =”6.1.6011.0“/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =”VectorDraw.Generics“publicKeyToken =”54eac14e23c9ee53 “culture =”neutral“/> <bindingRedirect oldVersion =”0.0.0.0-6.1.65535.65535“newVersion =”6.1.6011.0“/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“VectorDraw.Geometry”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion =“0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“VectorDraw.Render”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion =“0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“RenderFormats”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion =“0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“VectorDraw.Serialize”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion =“0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“VDrawBaseControl”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion =“0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“vdCommandLine”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion = “0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“vdFramedControl”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion =“0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“VectorDraw.Professional”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion =“0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“vdPropertyGrid”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion =“0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“vdScrollableControl”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion =“0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“WinMsgMannager”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion =“0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“VectorDraw.ExDialogs”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion =“0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“VectorDraw.Fonts”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion =“0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“VdProControl”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion =“0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“vdxFcnv”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion = “0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“OpenVDF”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion =“0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“vdDXF”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion =“0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> <dependentAssembly> <assemblyIdentity name =“VdrawPro5”publicKeyToken =“54eac14e23c9ee53”culture =“neutral”/> <bindingRedirect oldVersion = “0.0.0.0-6.1.65535.65535”newVersion =“6.1.6011.0”/> </ dependentAssembly> </ assemblyBinding> </ runtime> </ configuration>
相反也是可能的,比如使用6011构建你的exe并使其运行6009安装。在这种情况下,使用6011构建项目时使用的属性/方法/事件不应从6011更改为6009。
二. 设置显示工具提示之前的延迟时间
问:我们在我们的软件中对某些绘图对象使用VDraw工具提示。今天,工具提示完全显示在光标在对象上移动的那一刻。是否可以在显示工具提示之前设置延迟(例如2秒)?
答:可以通过应用程序中的代码实现,如下所示。您将需要一个将在MouseMove事件上启动的Timer,并且在计时器代码上将显示一个代码,该代码将显示工具提示。这样,工具提示将在设置为计时器的时间间隔之后显示,并且鼠标不在实体上移动。
//On Form Load we initialize the events. //Note that EnableTooltips is set to False!!!!! private void Form1_Load(object sender, EventArgs e) { //........ vdFramedControl.BaseControl.MouseMove += new MouseEventHandler(BaseControl_MouseMove); mTimer.Interval = 5000; mTimer.Tick += new EventHandler(mTimer_Tick); vdFramedControl.BaseControl.ActiveDocument.EnableToolTips = false; mTimer.Start(); } //On mouse move we constantly reset the timer void BaseControl_MouseMove(object sender, MouseEventArgs e) { mTimer.Stop(); mTimer.Start(); } //On the timer's code we write the following in order to show the tooltip void mTimer_Tick(object sender, EventArgs e) { if (!vdFramedControl.BaseControl.Visible) return; if (vdFramedControl.BaseControl.ActiveDocument.ActiveLayOut.OverAllActiveActions.Count > 1) return; VectorDraw.Actions.BaseAction action = vdFramedControl.BaseControl.ActiveDocument.ActiveLayOut.OverAllActiveAction; if (!action.IsVisible) return; vdFramedControl.BaseControl.ActiveDocument.EnableToolTips = true; //This will show the tooltip if there is any!!!! action.MouseMove(new MouseEventArgs(MouseButtons.None, 0, action.GdiMouseLocation.X, action.GdiMouseLocation.Y, 0), action.MouseLocation, action.OrthoPoint); vdFramedControl.BaseControl.ActiveDocument.EnableToolTips = false; } //Don't forget to do the finalizations at the closing of the application protected override void OnClosing(CancelEventArgs e) { mTimer.Tick -= new EventHandler(mTimer_Tick); vdFramedControl.BaseControl.MouseMove -= new MouseEventHandler(BaseControl_MouseMove); mTimer.Stop(); mTimer.Dispose(); base.OnClosing(e); }
三. 过滤选择文档特定布局的所有图层的所有折线
问:如何过滤选择文档特定布局的所有图层的所有折线?
答:可通过以下代码实现:
//Create a selection VectorDraw.Professional.vdCollections.vdSelection selset = new vdSelection("Myselset"); selset.SetUnRegisterDocument(vdFramedControl1.BaseControl.ActiveDocument); //Create a filter VectorDraw.Professional.vdObjects.vdFilterObject filter = new vdFilterObject(); //Add ALL Layer names to the filter(you can add simply 1 layer if you want foreach (vdLayer var in vdFramedControl1.BaseControl.ActiveDocument.Layers) { filter.Layers.AddItem(var.Name); } //Add vdPolyline to select all polylines filter.Types.AddItem("vdPolyline"); //Add the name of the layout you want to check if no name is specified then ALL layouts will be checked filter.LayOuts.AddItem(vdFramedControl1.BaseControl.ActiveDocument.ActiveLayOut.Name); //Apply the filter. After this the selection will contain the selected polylines. selset.FilterSelect(filter);
四. 不想显示选择交叉绿色和窗口蓝色矩形以及不在夹点选择中添加的所选实体
问:我不想显示选择交叉绿色和窗口蓝色矩形以及不在夹点选择中添加的所选实体,可以怎么做?
答:应用程序表单中的带有vdFrameControl的C#中的示例:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using VectorDraw.Professional.vdCollections; namespace WindowsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); //do not show the green and blue selecting colors vdFramedControl1.BaseControl.ActiveDocument.GlobalRenderProperties.SelectingCrossColor = Color.Empty; vdFramedControl1.BaseControl.ActiveDocument.GlobalRenderProperties.SelectingWindowColor = Color.Empty; vdFramedControl1.BaseControl.ActiveDocument.OnFilterFigure += new VectorDraw.Professional.vdObjects.vdDocument.FilterFigureEventHandler(ActiveDocument_OnFilterFigure); } void ActiveDocument_OnFilterFigure(object sender, VectorDraw.Professional.Constants.VdConstFilterFig JobId, VectorDraw.Professional.vdPrimaries.vdFigure fig, ref bool cancel) { //do not add the entities in default vdraw grip selections. if (JobId != VectorDraw.Professional.Constants.VdConstFilterFig.FILTERFIG_SELECT) return; if (fig == null) return; vdSelection gripset = sender as vdSelection; if (gripset == null) return; if (!gripset.Name.StartsWith("VDGRIPSET")) return; cancel = true; //throw new Exception("The method or operation is not implemented."); } } }
未完待续......