draw 发表于 2003-9-6 11:09:00

这个问题如何解决

在VB中如何取得ZoomCenter当前的缩放倍率的值.
怎样实现连续放大,并如何终止?

mccad 发表于 2003-9-6 12:41:00

ZoomCenter方法中当前的缩放倍率为当前视口中显示的图形高度,你可以通过以下语句来取得:
ThisDrawing.GetVariable("viewsize")
连续放大只需要循环就行。

draw 发表于 2003-9-6 17:38:00

请详细一点!

请详细一点!
并说明循环如何终止!

mccad 发表于 2003-9-6 18:02:00

把以下代码写入到模块中运行就可以了:

Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

Private Const VK_ESCAPE = &H1B

Sub zc()
On Error Resume Next
Dim vhight As Double
Dim Center As Variant
Center = ThisDrawing.Utility.GetPoint(, "选择缩放的中心点:")
vhight = ThisDrawing.GetVariable("viewsize")
GetAsyncKeyState VK_ESCAPE
Do
    ZoomCenter Center, vhight
    If GetAsyncKeyState(VK_ESCAPE) <> 0 Then
      Exit Do
    Else
      vhight = vhight + 0.1
    End If
Loop
   
End Sub

draw 发表于 2003-9-6 18:03:00

前一个问题明白了。循环如何终止呢?因为连续放大的次数是不确定的。

mccad 发表于 2003-9-6 18:26:00

按取消键不就可以终止了吗。
程序已经是这样写的。

mccad 发表于 2003-9-6 21:34:00

问一声,你这样做为了什么目的?

draw 发表于 2003-9-6 22:51:00

用取消键,感觉不好,能否使用鼠标右键终止?
怎样读取?
或者判断鼠标左键离开了视口拾取了哪个功能后,再终止

mccad 发表于 2003-9-7 07:09:00

那就再加些判断,按右键也结束。
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

Private Const VK_ESCAPE = &H1B
Private Const VK_RBUTTON = &H2

Sub zc()
On Error Resume Next
Dim vhight As Double
Dim Center As Variant
Center = ThisDrawing.Utility.GetPoint(, "选择缩放的中心点:")
vhight = ThisDrawing.GetVariable("viewsize")
GetAsyncKeyState VK_ESCAPE
GetAsyncKeyState VK_RBUTTON
Do
    ZoomCenter Center, vhight
    If GetAsyncKeyState(VK_ESCAPE) <> 0 _
       Or GetAsyncKeyState(VK_RBUTTON) <> 0 Then
      Exit Do
    Else
      vhight = vhight + 0.5
    End If
Loop
   
End Sub

draw 发表于 2003-9-7 08:59:00

工程师这些 VK_ESCAPE, VK_RBUTTON 哪里来的?
页: [1] 2
查看完整版本: 这个问题如何解决