Vb.net 图形、缩放功能
我在处理一个缩放方程。工作范围是在缩放时将鼠标位置保持为轴。 我的意思是,如果a选择图片中的一个点,鼠标位置周围的世界会变得更大, 但是直线、圆弧或鼠标下方的其他东西应该保持在这个位置。 对于那些每天制作图形的人来说,对我来说花了很多时间的是一个儿童游戏。 这是我实际的缩放功能。 xo,yo是形状的点0,0的坐标Vb.net 图形、缩放功能,vb.net,graphics,zooming,Vb.net,Graphics,Zooming,我在处理一个缩放方程。工作范围是在缩放时将鼠标位置保持为轴。 我的意思是,如果a选择图片中的一个点,鼠标位置周围的世界会变得更大, 但是直线、圆弧或鼠标下方的其他东西应该保持在这个位置。 对于那些每天制作图形的人来说,对我来说花了很多时间的是一个儿童游戏。 这是我实际的缩放功能。 xo,yo是形状的点0,0的坐标 Private Sub dlgSelectShape_MouseWheel(ByVal sender As Object, _ ByVal e As System.Wind
Private Sub dlgSelectShape_MouseWheel(ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel
Dim p As Point
p = e.Location
p = Me.PointToScreen(p)
p = PictureBox1.PointToClient(p)
If p.X > 0 And p.Y > 0 Then
If e.Delta > 0 Then
'lscale =scale factor
lscale = 0.01 * e.Delta * lscale
Else
'lscale =scale factor
lscale = -lscale / (0.01 * e.Delta)
End If
'xo = point of origin it is the coordinate of the point (0,0)
xo = xo + (-xo + p.X) * lscale / 2
yo = yo + (yo - p.Y) * lscale / 2
Draw()
End If
End Sub
你的问题是?它不起作用。偏移量是随机的。我应该使用什么等式来缩放鼠标位置!你的问题是?它不起作用。偏移量是随机的。我应该使用什么等式来缩放鼠标位置!