彩票走势图

VDF常见问题整理(七十):单击是否可以创建旋转的连续尺寸?

翻译|使用教程|编辑:李显亮|2021-04-08 10:06:25.387|阅读 119 次

概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常见问题,教程整理的很齐全,非常适合新手学习。本文将会介绍单击如何创建旋转尺寸。

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

相关链接:

VectorDraw Developer Framework(VDF)是一个用于应用程序可视化的图形引擎库。有了VDF提供的功能,您可以轻松地创建、编辑、管理、输出、输入和打印2D和3D图形文件。该库还支持许多矢量和栅格输入和输出格式,包括本地PDF和SVG导出。

点击下载VectorDraw Developer Framework


问:单击是否可以创建旋转的连续尺寸?

您可以尝试如下代码:

gPoint prevPT = null; // the point that th euser clicked previously
gPoint DimPos = null; // position of the dimensions
bool IsOnDimCont = false;

private void button1_Click(object sender, EventArgs e)
{
    //where doc is a vdDocument, like vdFramedControl1.BaseControl.ActiveDocument
    IsOnDimCont = false;
    if (doc.CommandAction.CmdDim(VectorDraw.Professional.Constants.VdConstDimType.dim_Rotated, null, null, 0.0d)) 
    {
        vdDimension dim = doc.ActiveLayOut.Entities.Last as vdDimension;
        prevPT = doc.World2UserMatrix.Transform(new gPoint(dim.DefPoint2)); // get the last point the user clicked and keep it for the next dimension
        gPoint DimPos = doc.World2UserMatrix.Transform(new gPoint(dim.LinePosition)); // or you can calculate this by using the midpoint of DefPoint1 & DefPoint2 plus a DX/DY 
        doc.OnPrompt += new vdDocument.PromptEventHandler(doc_OnPrompt);// enable the event
        for (int i = 0; i < 5; i++) // here you can change it to a do..while loop 
        {
            IsOnDimCont = true;
            if (doc.CommandAction.CmdDim(VectorDraw.Professional.Constants.VdConstDimType.dim_Rotated, null, DimPos, 0.0d))
            {
                vdDimension dimNext = doc.ActiveLayOut.Entities.Last as vdDimension;
                prevPT = doc.World2UserMatrix.Transform(new gPoint(dimNext.DefPoint2)); // get the last point the user clicked and keep it for the next dimension
            }
            IsOnDimCont = false;
        }
        doc.OnPrompt -= new vdDocument.PromptEventHandler(doc_OnContDimPrompt); // disable it
    }
}
 

void doc_OnContDimPrompt(object sender, ref string promptstr)
{
    if (IsOnDimCont && sender!=null && promptstr == "First Point:" ) // this means that it is inside your cont. dimension code
    {
        doc.PostCommandActionString(vdFramedControl1.BaseControl, prevPT.ToString()); // here we pass the first point of the new dimension using the prevPT stored earlier
    }
}

=======================================================

如果您对想要购买正版授权VectorDraw Developer Framework(VDF),可以联系咨询相关问题。


标签:

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


为你推荐

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


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP