判断点是否在多边形内部的演示程序[2]

[入库:2006年2月23日] [更新:2007年3月24日]

本文简介:

VERSION 5.00
Begin VB.Form frmDemo
   Caption         =   "GraphicDemo"
   ClientHeight    =   3090
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4680
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   ScaleHeight     =   3090
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton cmdReturn
      Caption         =   "返回"
      Height          =   375
      Left            =   1560
      TabIndex        =   1
      Top             =   2640
      Visible         =   0   'False
      Width           =   1455
   End
   Begin VB.CommandButton cmdStart
      Caption         =   "开始"
      Height          =   375
      Left            =   1560
      TabIndex        =   0
      Top             =   1800
      Width           =   1455
   End
   Begin VB.Shape Shape1
      Height          =   2415
      Left            =   120
      Top             =   120
      Width           =   4455
   End
End
Attribute VB_Name = "frmDemo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim poly() As Point, x1 As Integer, y1 As Integer, x2 As Integer, y2 As Integer
Private Sub cmdStart_Click()
  cmdStart.Visible = False
  cmdReturn.Visible = True
  ReDim poly(0) As Point
  frmDemo.Tag = "Begin"
End Sub

Private Sub cmdReturn_Click()
  cmdStart.Visible = True
  cmdReturn.Visible = False
  frmDemo.Tag = ""
  Line (x1, y1)-(x2, y2), vbButtonFace, BF
End Sub

Private Sub Form_Initialize()
  With Shape1
  x1 = .Left + 12
  y1 = .Top + 12
  x2 = .Left + .Width - 24
  y2 = .Top + .Height - 24
  End With
End Sub

本文关键:判断点是否在多边形内部的演示程序
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top