翻譯|使用教程|編輯:況魚杰|2019-12-17 09:36:56.470|閱讀 346 次
概述:本系列教程整理了VectorDraw Developer Framework(VDF)最常見問題,教程整理的很齊全,非常適合新手學(xué)習(xí)。本文將會展示如何使用方向鍵來模擬CommandAction.View3D( VROT)的代碼。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
VectorDraw Developer Framework(VDF)是一個用于應(yīng)用程序可視化的圖形引擎庫。有了VDF提供的功能,您可以輕松地創(chuàng)建、編輯、管理、輸出、輸入和打印2D和3D圖形文件。
VectorDraw Developer Framework試用版下載
問:
在VDF中,如果我想使用諸如UP,DOWN,LEFT RIGHT之類的方向鍵來模擬CommandAction.View3D( VROT)。然后在每次單擊方向按鈕時,呈現(xiàn)的結(jié)果是按照預(yù)定的方向沿該方向旋轉(zhuǎn)場景。想要請問怎么樣才能實現(xiàn)?
答:
很簡單,只需要以表單形式添加vdFramed或vdScrollable控件和五個按鈕,然后嘗試執(zhí)行以下代碼:
private void buttonCreateScene_Click(object sender, EventArgs e) { //doc is the vdFramed.BaseControl.ActiveDocument doc.New(); // just create some 3D objects for testing doc.CommandAction.CmdBox3d(new gPoint(2000, 1000), 3.0d, 4.0d, 5.0d, 0.0d); doc.CommandAction.CmdSphere(new gPoint(2008, 1003), 2.0d, 6, 7); doc.CommandAction.View3D("SHADEON"); doc.CommandAction.View3D("VISE"); doc.CommandAction.Zoom("S", 0.5, 0); } // this is the step you need to set double step = VectorDraw.Geometry.Globals.DegreesToRadians(5.0d); // 5 degrees step private void buttonUP_Click(object sender, EventArgs e) { gPoint ptV = doc.ActiveLayOut.Render.ProjectionMatrix.GetInvertion().projectTransform(0, 0, 0); Matrix mat = new Matrix(); mat.Multiply(doc.ActiveLayOut.World2ViewMatrix); mat.TranslateMatrix(ptV * -1.0d); mat.RotateXMatrix(step * -1.0d); mat.TranslateMatrix(ptV); doc.World2ViewMatrix = mat; doc.Redraw(true); } private void buttonDOWN_Click(object sender, EventArgs e) { gPoint ptV = doc.ActiveLayOut.Render.ProjectionMatrix.GetInvertion().projectTransform(0, 0, 0); Matrix mat = new Matrix(); mat.Multiply(doc.ActiveLayOut.World2ViewMatrix); mat.TranslateMatrix(ptV * -1.0d); mat.RotateXMatrix(step); mat.TranslateMatrix(ptV); doc.World2ViewMatrix = mat; doc.Redraw(true); } private void buttonRIGHT_Click(object sender, EventArgs e) { gPoint ptV = doc.ActiveLayOut.Render.ProjectionMatrix.GetInvertion().projectTransform(0, 0, 0); Matrix mat = new Matrix(); mat.Multiply(doc.ActiveLayOut.World2ViewMatrix); mat.TranslateMatrix(ptV * -1.0d); mat.RotateYMatrix(step * -1.0d); mat.TranslateMatrix(ptV); doc.World2ViewMatrix = mat; doc.Redraw(true); } private void buttonLEFT_Click(object sender, EventArgs e) { gPoint ptV = doc.ActiveLayOut.Render.ProjectionMatrix.GetInvertion().projectTransform(0, 0, 0); Matrix mat = new Matrix(); mat.Multiply(doc.ActiveLayOut.World2ViewMatrix); mat.TranslateMatrix(ptV * -1.0d); mat.RotateYMatrix(step); mat.TranslateMatrix(ptV); doc.World2ViewMatrix = mat; doc.Redraw(true); }
以上問答,如果您有任何的疑惑都可以在評論區(qū)留言,我們會及時回復(fù)。此系列的問答教程我們會持續(xù)更新,如果您感興趣,可以多多關(guān)注本教程。
熱門文章推薦:
=======================================================
如果您對想要購買正版授權(quán)VectorDraw Developer Framework(VDF),可以聯(lián)系咨詢相關(guān)問題。
關(guān)注慧聚IT微信公眾號 ???,了解產(chǎn)品的最新動態(tài)及最新資訊。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自: