Questo potrebbe esserti utile:
Crea un progetto vuoto
interfaccia grafica:
il form1 con proprietà AutoRedraw=true, ScaleMode=3 - Pixel e DrawStyle=0 - Solid
un controllo timer1 con le proprieta intervall=1 e enabled=true
un command1 con proprietà caption="Controlla se il punto si trova all'interno del poligono"
incolla questo codice
'--------------da quì---------------------------
Option Explicit
Dim x1, y1
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Coordinate As POINTAPI
Private Declare Function GetCursorPos Lib "User32.dll" (lpPoint As POINTAPI) As Long
Private Declare Function SetCursorPos Lib "User32.dll" (ByVal X As Long, ByVal Y As Long) As Long
Private Sub Command1_Click()
If x1 = 1000 Or y1 = 1000 Then
MsgBox ("Nessun punto è stato disegnato!")
Exit Sub
End If
If x1 > 5 And x1 < 295 And y1 > 5 And y1 < 196 Then MsgBox ("Il punto è dentro il poligono"): Exit Sub
MsgBox ("Il punto è fuori del poligono")
End Sub
Private Sub Form_Load()
Line (5, 5)-(300, 5), QBColor(15)
Line (5, 5)-(5, 200), QBColor(15)
Line (300, 200)-(5, 200), QBColor(15)
Line (300, 200)-(300, 5), QBColor(15)
x1 = 1000: y1 = 1000
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim CX, CY
DrawWidth = 5
FontSize = 24
CX = ScaleWidth / 2
CY = ScaleHeight / 2
Coordinate.X = Coordinate.X - CX
Coordinate.Y = Coordinate.Y - CY
PSet (x1, y1), QBColor(7)
x1 = Coordinate.X
y1 = Coordinate.Y
PSet (Coordinate.X, Coordinate.Y), QBColor(9)
DrawWidth = 1
End Sub
Private Sub Timer1_Timer()
Dim Esegui As Long
Esegui = GetCursorPos(Coordinate)
End Sub
'--------a quì----------------------------------
link
homepage
http://%77%77%77%2e%74%77%6f%72%6b%2e%69%74/
software
http://%77%77%77%2e%74%77%6f%72%6b%2...programmi.html
forum
http://%77%77%77%2e%74%77%6f%72%6b%2...um/default.asp