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

📄 form08.frm

📁 这是一个计算面积的程序
💻 FRM
字号:
VERSION 5.00
Object = "{9BD6A640-CE75-11D1-AF04-204C4F4F5020}#2.0#0"; "mo20.ocx"
Begin VB.Form Form08 
   Caption         =   "Inset演示"
   ClientHeight    =   4830
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5865
   LinkTopic       =   "Form1"
   ScaleHeight     =   4830
   ScaleWidth      =   5865
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command3 
      Caption         =   "放大"
      Height          =   495
      Left            =   3960
      TabIndex        =   3
      Top             =   4200
      Width           =   1215
   End
   Begin VB.CommandButton Command2 
      Caption         =   "缩小"
      Height          =   495
      Left            =   2400
      TabIndex        =   2
      Top             =   4200
      Width           =   1335
   End
   Begin VB.CommandButton Command1 
      Caption         =   "原图显示"
      Height          =   495
      Left            =   720
      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        =   "form08.frx":0000
   End
End
Attribute VB_Name = "Form08"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Xuewei,2003/5/31
'改变对象尺寸方法Inset示例;

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

Private Sub Command1_Click()
  Dim pt As Point
  Const Pm = 0.4
   
  '画一个矩形;
  Set Rect1 = New MapObjects2.Rectangle
  Set pt = Map1.ToMapPoint(2500, 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.Inset Pset1, Pset2
    Map1.TrackingLayer.Refresh True
  Else
    MsgBox "先点击“原图显示”按钮!"
  End If
End Sub

Private Sub Command3_Click()
  Const Pset1 = -0.1
  Const Pset2 = 0.1
  
  If Not Rect1 Is Nothing Then
    Set Rect2 = Rect1
    Rect2.Inset 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 + -