翻譯|使用教程|編輯:李顯亮|2021-04-08 10:06:25.387|閱讀 198 次
概述:本系列教程整理了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@ke049m.cn