⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form07.frm

📁 这是一个计算面积的程序
💻 FRM
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Begin VB.Form Form07 
   Caption         =   "Offset演示"
   ClientHeight    =   4830
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5865
   LinkTopic       =   "Form1"
   ScaleHeight     =   4830
   ScaleWidth      =   5865
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "结果显示"
      Height          =   495
      Left            =   3120
      TabIndex        =   2
      Top             =   4200
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "原图显示"
      Height          =   495
      Left            =   1200
      TabIndex        =   1
      Top             =   4200
      Width           =   1335
   End
   Begin MapObjects2.Map Map1 
      Height          =   3975
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   5655
      _Version        =   131072
      _ExtentX        =   9975
      _ExtentY        =   7011
      _StockProps     =   225
      BackColor       =   16777215
      BorderStyle     =   1
      Contents        =   "form07.frx":0000
   End
End
Attribute VB_Name = "Form07"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xuewei,2003/5/31
'改变对象位置的方法Offset示例;

Option Explicit
Dim Rect1 As MapObjects2.Rectangle
Dim Rect2 As MapObjects2.Rectangle

Private Sub Command1_Click()
  Dim Pt As Point
  Const Pm = 0.3
   
  '画第一个矩形;
  Set Rect1 = New MapObjects2.Rectangle
  Set Pt = Map1.ToMapPoint(2000, 2000)
  Rect1.Top = Pt.y - Pm
  Rect1.Bottom = Pt.y + Pm
  Rect1.Left = Pt.x - Pm
  Rect1.Right = Pt.x + Pm
     
  Set Rect2 = Nothing
  Map1.TrackingLayer.Refresh True
End Sub

Private Sub Command2_Click()
  Const Pset1 = 0.1
  Const pset2 = -0.1
  
  If Not Rect1 Is Nothing Then
    Set Rect2 = Rect1
    Rect2.Offset Pset1, pset2
    Map1.TrackingLayer.Refresh True
  Else
    MsgBox "先点击“显示”按钮!"
  End If
End Sub

Private Sub Map1_AfterTrackingLayerDraw(ByVal hDC As stdole.OLE_HANDLE)
  Dim sym1 As New Symbol, sym2 As New Symbol
  
  sym1.Color = moRed
  sym2.Color = moGreen
      
  If Not Rect1 Is Nothing Then
    Set Rect2 = Nothing
    Map1.DrawShape Rect1, sym1
  ElseIf Not Rect2 Is Nothing Then
    Map1.DrawShape Rect2, sym2
  End If
End Sub



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -