• <menu id="w2i4a"></menu>
  • logo VectorDraw教程

    文檔首頁(yè)>>VectorDraw教程>>新手入門(mén)必看:VectorDraw 常見(jiàn)問(wèn)題整理大全(六)

    新手入門(mén)必看:VectorDraw 常見(jiàn)問(wèn)題整理大全(六)


    VectorDraw Developer Framework(VDF)是一個(gè)用于應(yīng)用程序可視化的圖形引擎庫(kù)。有了VDF提供的功能,您可以輕松地創(chuàng)建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。該庫(kù)還支持許多矢量和柵格輸入和輸出格式,包括本地PDF和SVG導(dǎo)出。

    VectorDraw Developer Framework最新版下載

    VectorDraw web library (javascript)是一個(gè)矢量圖形庫(kù)。VectorDraw web library (javascript)不僅能打開(kāi)CAD圖紙,而且能顯示任何支持HTML5標(biāo)準(zhǔn)平臺(tái)上的通用矢量對(duì)象,如Windows,安卓,iOS和Linux。無(wú)需任何安裝,VectorDraw web library (javascript)就可以運(yùn)行在任何支持canvas標(biāo)簽和Javascript的主流瀏覽器(Chrome, Firefox, Safari, Opera, Dolphin, Boat等等)中。

    VectorDraw web library (javascript)最新版下載

    一. 更改PropertyGrid的寬度和CommandLine的高度

    問(wèn):如何在vdFramedControl中更改PropertyGrid的寬度和CommandLine的高度?

    答:您可以使用代碼執(zhí)行此操作,例如:

    vdFramedC.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.CommandLine, true); // Show the CommandLine
    vdFramedC.SetLayoutStyle(vdControls.vdFramedControl.LayoutStyle.PropertyGrid, true); // Show the PropertyGrid
    vdFramedC.HistoryLines = 4; // Change CommandLine's Height, changing the history lines that will be displayed
    vdFramedC.PropertyGridWidth = vdFramedControl.PropertyGridWidth * 2;// Change PropertyGrid's Width

    二. 在不將這些操作添加到撤消/重做的情況下進(jìn)行縮放/平移

    問(wèn):如何在不使用.NET組件將這些操作添加到撤消/重做列表的情況下進(jìn)行縮放/平移?

    答:您可以使用vdDocument事件的onUndoStoreValue,當(dāng)ViewSize或ViewCenter發(fā)生更改時(shí)(這會(huì)發(fā)生縮放和/或平移),然后將Cancel設(shè)置為true。例如:

    private void Form1_Load(object sender, EventArgs e)
    {
    vdFramedControl1.BaseControl.ActiveDocument.OnUndoStoreValue += new VectorDraw.Professional.vdObjects.vdDocument.UndoStoreValueEventHandler(ActiveDocument_OnUndoStoreValue);
    } 
    void ActiveDocument_OnUndoStoreValue(object sender, bool isRedo, object propObject, string propName, object value, ref bool Cancel)
    {
    if (propName.ToLower() == "viewcenter" || propName.ToLower() == "viewsize") 
    { // zoom pan change ViewCenter and ViewSize
    Cancel = true; // This will not write to the UNDO the pan/zoom actions
    }
    }

    對(duì)于7版本的代碼應(yīng)該是:

            void ActiveDocument_OnUndoStoreValue(object sender, bool isRedo, object propObject, string propName, object value, ref bool Cancel)
            {
                if (propName.ToLower() == "viewcenter" || propName.ToLower() == "viewsize" || propObject.ToString().ToLower() == "zoom")
                { // zoom & pan change ViewCenter and ViewSize
                    Cancel = true; // This will not write to the UNDO the pan/zoom actions
                }
            }

    三. 在ACAD中顯示的直徑符號(hào)

    問(wèn):如何在ACAD中顯示的直徑符號(hào)?

    答:您可以使用vdDocument事件的onUndoStoreValue,當(dāng)ViewSize或ViewCenter發(fā)生更改時(shí)(這會(huì)發(fā)生縮放和/或平移),然后將Cancel設(shè)置為true。例如:

    ***本文適用于6010及以上版本***

    vdDimStyle的新屬性在6010 DiameterSymbol中添加了直徑類型尺寸,RadialSymbol用作徑向類型尺寸的前綴默認(rèn)情況下,“D”用于直徑,“R”用于徑向

    您可以通過(guò)實(shí)現(xiàn)以下兩個(gè)事件讓您的應(yīng)用程序使用特定的Diameter和徑向字符串值:

    public Form1()
    {
        InitializeComponent();
        vdFramedControl1.BaseControl.AfterNewDocument += new VectorDraw.Professional.Control.AfterNewDocumentEventHandler(BaseControl_AfterNewDocument);
        vdFramedControl1.BaseControl.AfterOpenDocument += new VectorDraw.Professional.Control.AfterOpenDocumentEventHandler(BaseControl_AfterOpenDocument);
    }
    
    void ChangeDimensionsStylePrefix(string PrefixDiameter,string PrefixRadial)
    {
         foreach (vdDimstyle style in vdFramedControl1.BaseControl.ActiveDocument.DimStyles)
         {
              style.DiameterSymbol = PrefixDiameter;
              style.RadialSymbol = PrefixRadial;
         }
    }
    void BaseControl_AfterOpenDocument(object sender)
    {
        ChangeDimensionsStylePrefix("%%c","r");
    }
    void BaseControl_AfterNewDocument(object sender)
    {
        ChangeDimensionsStylePrefix("%%c","r");
    }

    四. 獲取圖形中使用的所有collors(可見(jiàn)實(shí)體)

    問(wèn):想從屏幕上繪制的實(shí)體中獲取顏色,所以如何獲取圖形中使用的所有collors(可見(jiàn)實(shí)體)?

    答:請(qǐng)參閱下面的代碼。它是在C#2005中使用vdFramed控件。調(diào)用onDrawFigure事件,從此事件的渲染中可以獲得PenStyle.Color。

    System.Collections.Generic.Dictionary<int, System.Drawing.Color> dictionarycolor;
    private bool countcolors = false;
    
    public Form1()
    {
        InitializeComponent();
    }
    
     
    
    private void Form1_Load(object sender, EventArgs e)
    {
        vdFC.BaseControl.ActiveDocument.FreezeEntityDrawEvents.Push(false);
        vdFC.BaseControl.ActiveDocument.OnDrawFigure += new VectorDraw.Professional.vdObjects.vdDocument.FigureDrawEventHandler(ActiveDocument_OnDrawFigure);
       // this event is needed. The render of this event has the PenStyle.Color
    }
    
    private void button3_Click(object sender, EventArgs e)
    {
       //create a dictionary to filter dublicate colors
       dictionarycolor = new Dictionary<int, Color>();
        countcolors = true;
        vdFC.BaseControl.ActiveDocument.Open(vdFC.BaseControl.ActiveDocument.GetOpenFileNameDlg(0, "", 0) as string);
        vdFC.BaseControl.ActiveDocument.Redraw(true);
        countcolors = false;
       //put the colors from dictionary in a simple array of System colors.
       System.Drawing.Color[] usedcolors = new Color[dictionarycolor.Count];
       int i = 0;
       foreach (System.Collections.Generic.KeyValuePair<int,System.Drawing.Color> var in dictionarycolor)
        {
          usedcolors.SetValue(var.Value,i ); i++;
        }
       MessageBox.Show("different colors used : "+ i.ToString());
    }
    
    void ActiveDocument_OnDrawFigure(object sender, VectorDraw.Render.vdRender render, ref bool cancel)
    {
       if (countcolors)
        {
          int key = render.PenStyle.color.GetHashCode();
          if(dictionarycolor.ContainsKey(key)) return;
            dictionarycolor.Add(key, render.SystemPenColor); //add the color to the dictionary if doesn't already exist
       }
    }

    五. 在vdraw的DblClick事件后顯示模式對(duì)話框時(shí)如何克服焦點(diǎn)問(wèn)題

    問(wèn):在Wrapper中,當(dāng)DblClick發(fā)生時(shí),此事件的處理程序中顯示的模態(tài)形式?jīng)]有焦點(diǎn),所以如何在vdraw的DblClick事件后顯示模式對(duì)話框時(shí)如何克服焦點(diǎn)問(wèn)題?

    答:***此解決方案適用于6009及以上版本***

    您可以使用CommandID事件和PostCommandID方法輕松解決此問(wèn)題。請(qǐng)參閱以下代碼:

    void CAdd3dEntitiesDlg::DblClickVdpro1()
    {
        m_vdraw.PostCommandId(555);
    }
    
    void CAdd3dEntitiesDlg::CommandIdVdpro1(long cmdid)
    {
        if(cmdid == 555){
            MyTest Dlg;
            Dlg.DoModal();
        }
    }

    未完待續(xù)......

    掃碼咨詢


    添加微信 立即咨詢

    電話咨詢

    客服熱線
    023-68661681

    TOP
    三级成人熟女影院,欧美午夜成人精品视频,亚洲国产成人乱色在线观看,色中色成人论坛 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();