Public s2a, x, y As Integer
Public Xa, Ya, Xb, Yb, Xc, Yc, Xd, Yd As Integer
Private Sub Command1_Click()
s2a = Sqr((x - Xa) ^ 2 + (y - Ya) ^ 2)
S2b = Sqr((x - Xb) ^ 2 + (y - Yb) ^ 2)
S2c = Sqr((x - Xc) ^ 2 + (y - Yc) ^ 2)
S2d = Sqr((x - Xd) ^ 2 + (y - Yd) ^ 2)
Min = s2a
If S2b < Min Then
Min = S2b
End If
If S2c < Min Then
Min = S2c
End If
If S2d < Min Then
Min = S2d
End If
Label3.Caption = "它到四点距离分别为" & s2a & "和" & S2b & "和" & S2c & "和" & S2d & "," & "最小值为:" & Min
End Sub
Private Sub Picture1_Click()
X1 = Picture1.ScaleLeft
Y1 = Picture1.ScaleTop
X2 = (Picture1.ScaleLeft + Picture1.ScaleWidth) / 2 '中心点X
Y2 = (Picture1.ScaleTop + Picture1.ScaleHeight) / 2
Label1.Caption = "相片中心坐标为:" & X2 & "," & Y2 '分别为起点和终点坐标
'A
Xa = Picture1.ScaleWidth / 3
Ya = Picture1.ScaleHeight / 3
'B
Xb = 2 * Picture1.ScaleWidth / 3
Yb = Picture1.ScaleHeight / 3
'C
Xc = Picture1.ScaleWidth / 3
Yc = 2 * Picture1.ScaleHeight / 3
'D
Xd = 2 * Picture1.ScaleWidth / 3
Yd = 2 * Picture1.ScaleHeight / 3
Label2.Caption = "四个重力点坐标为:" & "A(" & Xa & "," & Ya & ")" & "B(" & Xb & "," & Yb & ")" & "C(" & Xc & "," & Yc & ")" & "D(" & Xd & "," & Yd & ")"
End Sub
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
Label4.Caption = "鼠标选取的点坐标为" & x & "," & y
End Sub