BEDBOY008 发表于 2004-3-24 22:37:00

vba中如何实现鼠标控制三维图形的移动!请高手指点!谢谢!

请问斑竹和高手、大侠指点:


vba中如何实现鼠标控制三维图形的移动!请高手指点!谢谢!

mccad 发表于 2004-3-25 19:53:00

鼠标是用手控制的,而不是用程序控制的。

BEDBOY008 发表于 2004-3-25 21:02:00

不是这个意思!


我的意思是通过鼠标单击的感应确定三维图形的移动


在vba中实现


请斑竹多多指教


万分感激!谢谢!!


顺便请您帮我检查一下我的程序!


是移动三维图形的!


Public Sub MoveShape()


'move a shape from a to b in one or more step


<BR>Dim ShapeObject As Acad3DSolid<BR>Const NumberOfMoves = 200<BR>Dim StartPoint As Variant, EndPoint As Variant<BR>Dim CurrentPosition(0 To 2) As Double<BR>Dim LastPosition As Variant<BR>Dim IncX As Double, IncY As Double, IncZ As Double<BR>Dim Count As Integer, ButtonClicked As Integer<BR>StartPoint = ThisDrawing.Utility.GetPoint(, "Enter the startpoint for the starting position for the direction of the move. ")<BR>EndPoint = ThisDrawing.Utility.GetPoint(StartPoint, "Enter the EndPoint for the Ending Position for the direction of the move")<BR>ButtonClicked = MsgBox("Do you want to animate the move?", vbYesNo, "Moving Shape")<BR>If ButtonClicked = vbYes Then<BR>IncX = (EndPoint(0) - StartPoint(0)) / NumberOfMoves<BR>IncY = (EndPoint(1) - StartPoint(1)) / NumberOfMoves<BR>IncZ = (EndPoint(2) - StartPoint(2)) / NumberOfMoves<BR>        LastPosition = StartPoint<BR>        CurrentPosition(0) = StartPoint(0)<BR>        CurrentPosition(1) = StartPoint(1)<BR>       CurrentPosition(2) = StartPoint(2)<BR>       For Count = 1 To NumberOfMoves<BR>       CurrentPosition(0) = CurrentPosition(0) + IncX<BR>       CurrentPosition(1) = CurrentPosition(1) + IncY<BR>       CurrentPosition(2) = CurrentPosition(2) + IncZ<BR>ShapeObject.Move LastPosition, CurrentPosition


LastPosition = CurrentPosition<BR>ShapeObject.Update<BR>Next<BR>Else<BR>ShapeObject.Move StartPoint, EndPoint<BR>ShapeObject.Update<BR>End If<BR>        <BR>       <BR>End Sub<BR>
页: [1]
查看完整版本: vba中如何实现鼠标控制三维图形的移动!请高手指点!谢谢!