翻譯|使用教程|編輯:黃竹雯|2018-10-23 10:25:22.000|閱讀 466 次
概述:本教程整理了VectorDraw 最常見問題,教程整理的很齊全,非常適合新手學(xué)習(xí),希望對大家有一定的幫助!
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
VectorDraw Developer Framework(VDF)是一個用于應(yīng)用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創(chuàng)建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。該庫還支持許多矢量和柵格輸入和輸出格式,包括本地PDF和SVG導(dǎo)出。
【VectorDraw Developer Framework最新版下載】
VectorDraw web library (javascript)是一個矢量圖形庫。VectorDraw web library (javascript)不僅能打開CAD圖紙,而且能顯示任何支持HTML5標(biāo)準(zhǔn)平臺上的通用矢量對象,如Windows,安卓,iOS和Linux。無需任何安裝,VectorDraw web library (javascript)就可以運行在任何支持canvas標(biāo)簽和Javascript的主流瀏覽器(Chrome, Firefox, Safari, Opera, Dolphin, Boat等等)中。
【VectorDraw web library (javascript)最新版下載】
一. 更改PropertyGrid的寬度和CommandLine的高度
問:如何在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)行縮放/平移
問:如何在不使用.NET組件將這些操作添加到撤消/重做列表的情況下進(jìn)行縮放/平移?
答:您可以使用vdDocument事件的onUndoStoreValue,當(dāng)ViewSize或ViewCenter發(fā)生更改時(這會發(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 } }
對于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中顯示的直徑符號
問:如何在ACAD中顯示的直徑符號?
答:您可以使用vdDocument事件的onUndoStoreValue,當(dāng)ViewSize或ViewCenter發(fā)生更改時(這會發(fā)生縮放和/或平移),然后將Cancel設(shè)置為true。例如:
***本文適用于6010及以上版本***
vdDimStyle的新屬性在6010 DiameterSymbol中添加了直徑類型尺寸,RadialSymbol用作徑向類型尺寸的前綴默認(rèn)情況下,“D”用于直徑,“R”用于徑向
您可以通過實現(xiàn)以下兩個事件讓您的應(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(可見實體)
問:想從屏幕上繪制的實體中獲取顏色,所以如何獲取圖形中使用的所有collors(可見實體)?
答:請參閱下面的代碼。它是在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事件后顯示模式對話框時如何克服焦點問題
問:在Wrapper中,當(dāng)DblClick發(fā)生時,此事件的處理程序中顯示的模態(tài)形式?jīng)]有焦點,所以如何在vdraw的DblClick事件后顯示模式對話框時如何克服焦點問題?
答:***此解決方案適用于6009及以上版本***
您可以使用CommandID事件和PostCommandID方法輕松解決此問題。請參閱以下代碼:
void CAdd3dEntitiesDlg::DblClickVdpro1() { m_vdraw.PostCommandId(555); } void CAdd3dEntitiesDlg::CommandIdVdpro1(long cmdid) { if(cmdid == 555){ MyTest Dlg; Dlg.DoModal(); } }
未完待續(xù)......
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn