彩票走势图

logo VectorDraw教程
文档彩票走势图>>VectorDraw教程>>新手入门必看:VectorDraw 常见问题整理大全(十一)

新手入门必看: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)最新版下载

一. 在命令(或操作)处于活动状态时显示实体的工具提示

问:我想在命令(或动作)处于活动状态时显示光标下的实体工具提示。我怎样才能做到这一点 ?

答:默认情况下,在GetUserPoint等操作或活动命令期间无法显示工具提示。这也是着名的CAD应用程序的默认行为,如果将其添加到VDF默认行为,则可能会出现两个问题。

  • 隐藏工具提示区域下方的有用信息(端点,快照等),
  • 作为Osnaps减慢性能,除了绘图数据库搜索必须在工具提示窗口内绘制的文本之外,还必须计算交叉点蚀刻。

为此,我们无法在组件中添加此行为。如果您愿意,可以使用ActiveDocument.ActionLayout.GetEntifromPoint(使用布尔值更快的响应)或GetTooltipFigure,并获取光标下方图形的工具提示文本,并将其设置为文档的ToolTipText属性。就像是:

 
        private void Form1_Load(object sender, EventArgs e)
        {
            vdFramedControl.BaseControl.ActiveDocument.EnableToolTips = true;
            vdFramedControl.BaseControl.MouseMove += new MouseEventHandler(BaseControl_MouseMove);
        }
 
        void BaseControl_MouseMove(object sender, MouseEventArgs e)
        {
            bool allobjectsAresearched = false;
            vdFigure fig = vdFramedControl.BaseControl.ActiveDocument.ActionLayout.GetToolTipFigure(e.Location,vdFramedControl.BaseControl.ActiveDocument.ActiveActionRender.GlobalProperties.PickSize,true,out allobjectsAresearched);
            vdFramedControl.BaseControl.ActiveDocument.ToolTipText = "";
            if(fig == null) return;
            vdFramedControl.BaseControl.ActiveDocument.ToolTipText = fig.ToolTip;
        }
 

二. 在垂直于线的平面中的线起点和终点创建2个圆

问:如何在垂直于线的平面中的线起点和终点创建2个圆?

答:试试如下代码:

private void button3_Click(object sender, EventArgs e)

{  
//create a line

  VectorDraw.Professional.vdFigures.vdLine line = new VectorDraw.Professional.vdFigures.vdLine();

  line.SetUnRegisterDocument(vdFramedControl.BaseControl.ActiveDocument);

  line.setDocumentDefaults();

  line.StartPoint = new VectorDraw.Geometry.gPoint(2, 3, 4);

  line.EndPoint = new VectorDraw.Geometry.gPoint(7, 8, 2);

  line.PenColor.SystemColor = Color.Red;

  line.PenWidth = .1;

  vdFramedControl.BaseControl.ActiveDocument.ActiveLayOut.Entities.AddItem(line);

 

//create a circle at the StartPoin of the previous line

  VectorDraw.Professional.vdFigures.vdCircle circle_SP = new VectorDraw.Professional.vdFigures.vdCircle();

  circle_SP.SetUnRegisterDocument(vdFramedControl.BaseControl.ActiveDocument);

  circle_SP.setDocumentDefaults();

  circle_SP.Center = new VectorDraw.Geometry.gPoint(line.StartPoint);

  circle_SP.Radius = (double)1.0;

//Set the circle's Extrusion vector to have the direction StartPoint ---> EndPoint

  circle_SP.ExtrusionVector = new VectorDraw.Geometry.Vector(new VectorDraw.Geometry.gPoint(line.StartPoint), new VectorDraw.Geometry.gPoint(line.EndPoint));

  vdFramedControl.BaseControl.ActiveDocument.ActiveLayOut.Entities.AddItem(circle_SP);

 

//create a circle at the EndPoint of the previous line

  VectorDraw.Professional.vdFigures.vdCircle circle_EP = new VectorDraw.Professional.vdFigures.vdCircle();

  circle_EP.SetUnRegisterDocument(vdFramedControl.BaseControl.ActiveDocument);

  circle_EP.setDocumentDefaults();

  circle_EP.Center = new VectorDraw.Geometry.gPoint(line.EndPoint);

  circle_EP.Radius = (double)1.0;

//Set the circle's Extrusion vector to have the direction EndPoint ---> StartPoint

  circle_EP.ExtrusionVector = new VectorDraw.Geometry.Vector(new VectorDraw.Geometry.gPoint(line.EndPoint), new VectorDraw.Geometry.gPoint(line.StartPoint));

  vdFramedControl.BaseControl.ActiveDocument.ActiveLayOut.Entities.AddItem(circle_EP);

 

  vdFramedControl.BaseControl.ActiveDocument.CommandAction.Zoom("E", null, null);

  vdFramedControl.BaseControl.ActiveDocument.CommandAction.Zoom("S", (double)0.8, null);

  MessageBox.Show("Circles with the right extrusion VectorDraw created. Adding some thickness to the circles just to show the results");

  circle_SP.Thickness = 0.8;

  circle_EP.Thickness = 0.8;

  vdFramedControl.BaseControl.ActiveDocument.Redraw(false);

}

三. 显示框架控件,如Scrollable或类似vdBase控件

问:我如何使用vdFramed控件但显示它像vdScrollable控件或类似vdBase控件?

答:您可以使用以下代码:

Private Sub btn_ShowAsFramed_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShowAsFramed.Click
    '//Show PropertyGrid and Status Bar
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.CommandLine, True)
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.PropertyGrid, True)
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.StatusBar, True)
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.LayoutTab, True)
    '//Show scrollbars
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.HorizodalScroll, True)
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.VericalScroll, True)
    '//Show the Layout Tab
    VdFramedControl1.ScrollableControl.SetShowLayoutTab(True)
    '//if you set the vdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.StatusBar ,true)
    '// then you show some "features" like :
    VdFramedControl1.SetStatusBarOption(vdControls.vdFramedControl.StatusBarOptions.ProgressBar, True)
    VdFramedControl1.SetStatusBarOption(vdControls.vdFramedControl.StatusBarOptions.SnapButton, True)
    VdFramedControl1.SetStatusBarOption(vdControls.vdFramedControl.StatusBarOptions.Menu, True)
    VdFramedControl1.SetStatusBarOption(vdControls.vdFramedControl.StatusBarOptions.GridButton, True)
    VdFramedControl1.SetStatusBarOption(vdControls.vdFramedControl.StatusBarOptions.Paper, True)
    VdFramedControl1.SetStatusBarOption(vdControls.vdFramedControl.StatusBarOptions.OrthoButton, True)
    VdFramedControl1.SetStatusBarOption(vdControls.vdFramedControl.StatusBarOptions.OsnapButton, True)
    '// show the menu
    VdFramedControl1.ShowMenu(True)

    '// In the vdFramed's PropertyGrid the selection is show. This code below finds the selection and 
    '// set this to be shown in the Property Grid
    Dim propertygrid As vdPropertyGrid.vdPropertyGrid
    propertygrid = VdFramedControl1.vdGrid
    propertygrid.SelectedObject = VdFramedControl1.BaseControl.ActiveDocument ' set the default value
    '// Here we find the name of the Grip Selection
    Dim gripset As VectorDraw.Professional.vdCollections.vdSelection
    Dim selsetname As String = "VDGRIPSET_" + VdFramedControl1.BaseControl.ActiveDocument.ActiveLayOut.Handle.ToStringValue()
    If Not VdFramedControl1.BaseControl.ActiveDocument.ActiveLayOut.ActiveViewPort Is Nothing Then
        selsetname = selsetname + VdFramedControl1.BaseControl.ActiveDocument.ActiveLayOut.ActiveViewPort.Handle.ToStringValue()
    End If

    '// This is the Grip Selections that is show in the PropertyGrid
    gripset = VdFramedControl1.BaseControl.ActiveDocument.ActiveLayOut.Document.Selections.FindName(selsetname)
    If Not (gripset Is Nothing) Then
        If gripset.Count > 0 Then propertygrid.SelectedObject = gripset
    End If
End Sub

Private Sub btn_ShowAsScrollable_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShowAsScrollable.Click
    '//Hide PropertyGrid, CommandLine and Status Bar
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.CommandLine, False)
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.PropertyGrid, False)
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.StatusBar, False)
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.LayoutTab, True)
    '//Show scrollbars
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.HorizodalScroll, True)
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.VericalScroll, True)
    '//Show the Layout Tab
    VdFramedControl1.ScrollableControl.SetShowLayoutTab(True)
    '//if you set the vdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.StatusBar ,true)
    '// then you can hide some "features" like :
    VdFramedControl1.SetStatusBarOption(vdControls.vdFramedControl.StatusBarOptions.ProgressBar, False)
    VdFramedControl1.SetStatusBarOption(vdControls.vdFramedControl.StatusBarOptions.SnapButton, False)
    VdFramedControl1.SetStatusBarOption(vdControls.vdFramedControl.StatusBarOptions.Menu, False
    VdFramedControl1.SetStatusBarOption(vdControls.vdFramedControl.StatusBarOptions.GridButton, False)
    VdFramedControl1.SetStatusBarOption(vdControls.vdFramedControl.StatusBarOptions.Paper, False)
    VdFramedControl1.SetStatusBarOption(vdControls.vdFramedControl.StatusBarOptions.OrthoButton, False)
    VdFramedControl1.SetStatusBarOption(vdControls.vdFramedControl.StatusBarOptions.OsnapButton, False)
    '// Hide the Menu
    VdFramedControl1.ShowMenu(False)
End Sub

Private Sub btn_ShowAsBase_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShowAsBase.Click
    '//Hide PropertyGrid, commandLine, Layout tab and Status Bar
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.CommandLine, False)
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.PropertyGrid, False)
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.StatusBar, False)
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.LayoutTab, False)
    '//Hide scrollbars
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.HorizodalScroll, False)
    VdFramedControl1.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.VericalScroll, False)
    '//Hide the Layout Tab
    VdFramedControl1.ScrollableControl.SetShowLayoutTab(False)
    VdFramedControl1.ScrollableControl.SetShowVscroll(False)
    VdFramedControl1.ScrollableControl.SetShowVscroll(False)
End Sub

四. Vertexes的IsClockWise属性

问:可以在顶点中添加IsClockWise属性吗?凸起也不会在“顶点区域”中计算。

答:“顶点区域”仅针对2D点计算,没有凸起。此外,无法应用IsClockWise,因为顶点不像vdPolyline那样具有ECS矩阵。因此,为了获得Vertexes的区域,如果是时钟方式,则必须使用如下代码:

VectorDraw.Professional.vdFigures.vdPolyline poly = new VectorDraw.Professional.vdFigures.vdPolyline();
poly.SetUnRegisterDocument(vdFramedControl.BaseControl.ActiveDocument);
poly.SetDocumentDefaults();
poly.VertexList = new VectorDraw.Geometry.Vertexes(myVertexes);
poly.Update();
double myArea = poly.Area();
bool isClockW = poly.IsClockWise();

未完待续......

扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP