彩票走势图

新手入门必看:VectorDraw 常见问题整理大全(三)

翻译|使用教程|编辑:黄竹雯|2018-10-15 16:15:36.000|阅读 325 次

概述:本教程整理了VectorDraw 最常见问题,教程整理的很齐全,非常适合新手学习,希望对大家有一定的帮助!

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

相关链接:

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)最新版下载

一. 使用vdScrolableControl获取实体并在vdPropertyGrid中显示其属性

问:如何使用vdScrolableControl获取实体并在vdPropertyGrid中显示其属性?

答:可以试试像这样的代码:

private void Form1_Load(object sender, EventArgs e)
{ 
    AddLayoutEntities();
    vdSC.BaseControl.vdMouseClick += new VectorDraw.Professional.Control.MouseClickEventHandler(BaseControl_vdMouseClick); 
}

void BaseControl_vdMouseClick(MouseEventArgs e, ref bool cancel)
{
    VectorDraw.Professional.vdPrimaries.vdFigure fig;
    VectorDraw.Geometry.gPoint pt = vdSC.BaseControl.ActiveDocument.CursorPosCCS(e.Location);
    VectorDraw.Geometry.gPoint p1 = vdSC.BaseControl.ActiveDocument.World2PixelMatrix.Transform(pt as VectorDraw.Geometry.gPoint);
    Point location = new Point((int)p1.x, (int)p1.y);
    fig = vdSC.BaseControl.ActiveDocument.ActiveLayOut.GetEntityFromPoint(location, vdSC.BaseControl.ActiveDocument.ActiveLayOut.Render.GlobalProperties.PickSize, false);
    if (fig == null)
    {
        vdPGrid.SelectedObject = vdSC.BaseControl.ActiveDocument;
        this.Text = "NO Entity clicked";
    }
    else
    {
        vdPGrid.SelectedObject = fig;
        this.Text = "Entity clicked";
    }
}

二. 读取附加到polyhatch对象的折线

问:如何读取附加到polyhatch对象的折线?

答:您可以从hatch(孵化)中获取vdCurves,如下所示。请注意,填充对象可能包含vdCircle,vdArc以及通常所有类型的vdCurves。孵化是vdPolyhatch对象。

foreach (VectorDraw.Professional.vdCollections.vdCurves var in hatch.PolyCurves)
{
    foreach (VectorDraw.Professional.vdFigures.vdCurve var1 in var)
    {
        VectorDraw.Professional.vdFigures.vdPolyline poly1 = var1 as VectorDraw.Professional.vdFigures.vdPolyline;
         if (poly1 != null) MessageBox.Show("Found Polyline");
    }
}

三. 重写VectorDrawBaseControl的DrawBackground事件

问:如何重写VectorDrawBaseControl的DrawBackground事件,以便将Image绘制到Background?

答:以下示例覆盖VectorDrawBaseControl的DrawBackground和vdScroll事件,以便在rendermode is Wire2d时将图像绘制为背景。

Bitmap m_Bitmap;



        private void Form1_Load(object sender, EventArgs e)
        {
            vdFramedControl.BaseControl.DrawBackground += new VectorDraw.Professional.Control.DrawBackgroundEventHandler(BaseControl_DrawBackground);
            vdFramedControl.BaseControl.vdScroll += new VectorDraw.Professional.Control.ScrollEventHandler(BaseControl_vdScroll);



//create a bitmap object at runtime
            m_Bitmap = new Bitmap(vdFramedControl.BaseControl.Size.Width, vdFramedControl.BaseControl.Size.Height);
            Graphics g = Graphics.FromImage(m_Bitmap);
            g.Clear(vdFramedControl.BaseControl.ActiveDocument.Palette.Background);
            g.DrawString("VDraw", SystemFonts.DefaultFont, Brushes.Red, new PointF(vdFramedControl.BaseControl.Size.Width / 2, vdFramedControl.BaseControl.Size.Height/2));
            g.Dispose();
       }



//override the vdScroll event in order the pan and scroll draw the background properly.



        void BaseControl_vdScroll(object sender, ref double cx, ref double cy, ref bool cancel)
        {
            vdRender render = sender as vdRender;
            render.ViewCenter += new gPoint(cx, cy);
            vdFramedControl.BaseControl.ActiveDocument.Redraw(false); 
        }



       void BaseControl_DrawBackground(object sender, VectorDraw.Render.vdRender render, ref bool cancel)
        {
            System.Diagnostics.Debug.WriteLine("DrawBackground");
            if (m_Bitmap == null) return;
            if (!render.IsWire2d) return;//the following code is working only when 3d render is not active
            render.UnLock();
            Graphics g = render.graphics;
            if (g == null) return;
            g.Clear(render.BkColor);
            g.DrawImage(m_Bitmap, new Point(0, 0));
            g.DrawLine(Pens.Red, new Point(0, 0), new Point(render.Width, render.Height));
            render.Lock();



            cancel = true;
        }


标签:CAD工业4.0

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@pclwef.cn


为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP