VectorDraw開発フレームワーク(VDF)は、グラフィックスエンジンライブラリの可視化のためのアプリケーションです。VDFを使用すると、簡単に作成、編集、管理、エクスポート、インポートおよび2Dおよび3Dグラフィックファイルを印刷できるという機能を提供します。
任意のソフトウェアの使用の過程で必然的にいくつかの問題が発生します、VectorDraw開発フレームワーク(VDF)は同じですが、この記事では、我々は、プロセスを使用して、いくつかのマイナーな問題に対処します。
どのように遅いの問題を開くにはSHXフォントファイルの不足を解決するには?
Q:
私はこの状況を解決する方法、過程で不足のSHXフォントファイルがゆっくりと開くによるものですか?
回答:
描画.SHXは、デフォルトの検索パスVDFとして、いくつかのフォントファイルを使用して欠落している場合は、この現象につながることができ、vdTextStylesには存在しません。これらの文字のあまりのArial Arialの文字や複雑さがそのグラフィカル表現を計算するために多くの時間がかかるため、これらのテキストスタイルなので、デフォルトでは、これらのファイルは、ArialフォントTrueTypeフォントに置き換えられます。
( - アプリケーション・パス - または例えば、クリップに定義された描画 - または - vdDocument.SupportPathのファイルフォルダ)この速度をスピードアップするために、描画SHXフォントファイルが使用VDF検索パスに存在しなければなりません。
これらのSHXフォントファイルがなければ、それはまた、SHXフォントファイルは、アプリケーションと参照を交換しないで、常に次のようにSHXファイルのパスに存在しているイベントのアプリケーションを、OnNoFileFindカバーすることができます。
//この例では、描画フォルダまたはアプリケーションのパスに存在している必要がありtxt.shxを持つすべての参照されていないSHXファイルを置き換えてください。 .... doc.OnNoFileFind + =新しいvdDocument.NoFileFindEventHandler(ActiveDocument_OnNoFileFind)。//イベントハンドラを追加します BOOL fontSubstitute =偽; //イベントの回避再帰に「公共」変数 .... 無効ActiveDocument_OnNoFileFind(オブジェクト送信者、REF列のファイル名、REFブール成功) { //既存のtxt.shxフォントファイルに置き換えのSHXフォントファイル。 (もし!fontSubstitute && fileName.EndsWith( "SHX")) { fontSubstitute =真; //は再帰を持たないようにするためにtrueに設定します 成功= doc.FindFile(fileNameに出て "txt.shx"、); fontSubstitute = falseは、 (成功)を返すと、 } doc.Promptは( "\ rを\ n個のファイルが見つかりません:" +ファイル名); doc.Prompt(NULL)。 }
どのように削除するか、ブロックレイアウトは、項目を削除するには?
Q:
如何清除已删除的布局或块项目?
答:
在下面,我们创建了两个不同的示例,说明如何从布局或块中清除已擦除的项目。
示例1:清除已删除的活动布局项目。
var tempCol = []; var activelayout = vdcanvas.GetActiveLayout(); for (var k = 0; k < activelayout.Entities.Items.length; k++) { var fig = vdcanvas.GetEntityItem(activelayout.Entities.Items[k]); if (!fig.Deleted) tempCol.push(activelayout.Entities.Items[k]);//If not an item is Deleted we push it in our tempCol } activelayout.Entities.Items = tempCol;//update the active layout entities with the tempCol
示例2:清除块中已擦除的项目
var tempCol = []; var blk = vdcanvas.AddBlock("myblock");//let's say that the block we want to update is the 'blk' for (var k = 0; k < blk.Entities.Items.length; k++) { var fig = vdcanvas.GetEntityItem(blk.Entities.Items[k]); if (!fig.Deleted) tempCol.push(blk.Entities.Items[k]);//If not an item is Deleted we push it in our tempCol } blk.Entities.Items = tempCol;//update the block entities with the tempCol
如何获取要复制或移动的对象?
问:
我想在复制/移动动作结束之前获取要复制或移动的对象的新位置,以便在新位置有效的情况下进行一些计算。如何执行此操作?
答:
当动作为ActionGetTranfromSelection时,可以使用OnActionDraw事件,并使用动作的GetMatrix并检查诸如以下的对象:
void doc_OnActionDraw(object sender, object action, bool isHideMode, ref bool cancel) { if (action != null && action is VectorDraw.Professional.CommandActions.ActionGetTranfromSelection) { VectorDraw.Professional.CommandActions.ActionGetTranfromSelection trans = action as VectorDraw.Professional.CommandActions.ActionGetTranfromSelection; vdSelection sel = trans.Layout.Document.Selections.FindName("VDRAW_PREVIOUS_SELSET");// sel contains the object that are moved/copied/rotated etc. if (sel == null || sel.Count == 0) return; // this.Text = sel.Count.ToString(); /// for debugging Matrix mat = trans.GetMatrix(); // this is the matrix that is applied to the source object by the action foreach (vdFigure item in sel) { vdFigure tempfig = item.Clone(item.Document) as vdFigure; // get a coly of this object being transformed (copied/moved etc) tempfig.Transformby(mat); // transform this with the action’s GetMatrix // this tempfig is the temporary figure rendered by action copy/move etc // using this tempfig object you can do your calid position check, using bounding box etc } } }
活动激活时如何使用鼠标中键进行平移
问:
活动激活时如何使用鼠标中键进行平移?
答:
您可以通过使用vdmoudown和vdmouseup事件来执行此操作,因为要这样做,您必须在要平移时暂停活动操作,然后将其恢复到当前命令。一旦使用鼠标中键进行平移,而不是使用左键完成命令,就可能发生这种情况。
在下面,您可以看到一个示例:
var vdcanvas = vdmanager.AttachCanvas('canvas'); vdcanvas.vdmousedown = _vdmousedown; //set to the initialize page load vdcanvas.vdmouseup = _vdmouseup; vdcanvas.ActiveAction().PanMouseButton = vdConst.MouseMiddleButton; // set the middle mouse button for panning procedure function _vdmousedown(e) { var code = e.mousebutton; //get the mouse button code if (code === 2)vdcanvas.ActiveAction().Pause(); // middle mouse code is 2 } function _vdmouseup(e) { //resume the action when finishing the panning var code = e.mousebutton; if (code === 2)vdcanvas.ActiveAction().Resume(); }
对于以上问答,如果您有任何的疑惑都可以在评论区留言,我们会及时回复。此系列的问答教程我们会持续更新,如果您感兴趣,可以多多关注本教程。