本系列教程整理了VectorDraw Developer Framework(VDF)最常见问题,教程整理的很齐全,非常适合新手学习,本节教程将会介绍如何在能够转动圆圈的情况下,并在View3D VROT中更改视图旋转的方式。
VectorDraw Developer Framework试用版下载
问:
是否能够在转动圆圈的情况下,在View3D VROT中更改视图旋转的方式/p>
答:
可以通过覆盖VectorDrawBaseControl的vdKeyDown事件来完成。
例:
(假设我们在表单控件集合中添加了一个带有vdFramedControl的表单)
在以下示例中:
-
当用户按住Alt键,按左箭头键或右箭头键时,视图将在活动视图的Y轴上旋转。
-
当用户按住Alt键,按下向上或向下箭头键时,视图将在活动视图的X轴上旋转。
-
当用户按住控制键的同时按下左箭头键或右箭头键时,视图将在活动视图的Z轴上旋转。
private void Form1_Load(object sender, EventArgs e){vdFramedControl.BaseControl.vdKeyDown += new VectorDraw.Professional.Control.KeyDownEventHandler(BaseControl_vdKeyDown);}void BaseControl_vdKeyDown(KeyEventArgs e, ref bool cancel) { BaseAction action = doc.ActiveLayOut.OverAllActiveAction; if(action == null) return; Matrix curmat = new Matrix( action.Render.CurrentMatrix); bool done = false; if (e.Alt && e.KeyCode == Keys.Left) { curmat.RotateYMatrix(Globals.VD_PI_OVER_180 * 10 * 1.0d); done = true; } else if (e.Alt && e.KeyCode == Keys.Right) { curmat.RotateYMatrix(Globals.VD_PI_OVER_180 * 10 * -1.0d); done = true; } else if (e.Alt && e.KeyCode == Keys.Up) { curmat.RotateXMatrix(Globals.VD_PI_OVER_180 * 10 * 1.0d); done = true; } else if (e.Alt && e.KeyCode == Keys.Down) { curmat.RotateXMatrix(Globals.VD_PI_OVER_180 * 10 * -1.0d); done = true; } else if (e.Control && e.KeyCode == Keys.Left) { curmat.RotateZMatrix(Globals.VD_PI_OVER_180 * 10 * -1.0d); done = true; } else if (e.Control && e.KeyCode == Keys.Right) { curmat.RotateZMatrix(Globals.VD_PI_OVER_180 * 10 * 1.0d); done = true; } if (!done) return; action.Render.CurrentMatrix = curmat; doc.Redraw(true); cancel = true; }

标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!