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

📄 form1.frm

📁 线路工程中计算直线段的里程和其坐标的小程序
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   7755
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7830
   LinkTopic       =   "Form1"
   ScaleHeight     =   7755
   ScaleWidth      =   7830
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text6 
      Height          =   375
      Left            =   1680
      TabIndex        =   13
      Text            =   "Text6"
      Top             =   1800
      Width           =   1575
   End
   Begin VB.TextBox Text5 
      Height          =   4575
      Left            =   480
      MultiLine       =   -1  'True
      TabIndex        =   12
      Text            =   "Form1.frx":0000
      Top             =   3000
      Width           =   6615
   End
   Begin VB.CommandButton Command2 
      Caption         =   "保存"
      Height          =   495
      Left            =   4560
      TabIndex        =   11
      Top             =   2280
      Width           =   1695
   End
   Begin VB.CommandButton Command1 
      Caption         =   "计算"
      Height          =   495
      Left            =   2040
      TabIndex        =   10
      Top             =   2280
      Width           =   1695
   End
   Begin VB.Frame Frame2 
      Caption         =   "终点"
      Height          =   1335
      Left            =   3720
      TabIndex        =   1
      Top             =   240
      Width           =   3255
      Begin VB.TextBox Text4 
         Height          =   270
         Left            =   1560
         TabIndex        =   5
         Text            =   "432"
         Top             =   960
         Width           =   1335
      End
      Begin VB.TextBox Text3 
         Height          =   270
         Left            =   1560
         TabIndex        =   4
         Text            =   "322"
         Top             =   360
         Width           =   1215
      End
      Begin VB.Label Label4 
         Caption         =   "Y坐标:"
         Height          =   375
         Left            =   360
         TabIndex        =   9
         Top             =   840
         Width           =   1095
      End
      Begin VB.Label Label3 
         Caption         =   "X坐标:"
         Height          =   375
         Left            =   360
         TabIndex        =   8
         Top             =   240
         Width           =   615
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "起点"
      Height          =   1335
      Left            =   360
      TabIndex        =   0
      Top             =   240
      Width           =   2895
      Begin VB.TextBox Text2 
         Height          =   270
         Left            =   1200
         TabIndex        =   3
         Text            =   "43"
         Top             =   840
         Width           =   1095
      End
      Begin VB.TextBox Text1 
         Height          =   270
         Left            =   1200
         TabIndex        =   2
         Text            =   "43"
         Top             =   240
         Width           =   1095
      End
      Begin VB.Label Label2 
         Caption         =   "Y坐标"
         Height          =   255
         Left            =   240
         TabIndex        =   7
         Top             =   840
         Width           =   495
      End
      Begin VB.Label Label1 
         Caption         =   "X坐标:"
         Height          =   255
         Left            =   240
         TabIndex        =   6
         Top             =   240
         Width           =   615
      End
   End
   Begin VB.Label Label5 
      Caption         =   "起点里程:"
      Height          =   375
      Left            =   480
      TabIndex        =   14
      Top             =   1800
      Width           =   975
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
A_X = Val(Text1.Text)
A_Y = Val(Text2.Text)
B_X = Val(Text3.Text)
B_Y = Val(Text4.Text)
QD_LC = Val(Text6.Text)
Q = Atn((B_Y - A_Y) / (B_X - A_X))
D = Sqr((A_X - B_X) ^ 2 + (A_Y - B_Y) ^ 2)
For i = 1 To Int(D / 20)
    Xi = Format(A_X + Cos(Q) * i * 20, "00000.000")
    Yi = Format(A_Y + Sin(Q) * i * 20, "00000.000")
    LCi = Format(QD_LC + i * 20, "0000.000")
    
    Text5.Text = Text5.Text & "K" & Int(LCi / 1000) & "+" & Format(LCi - Int(LCi / 1000) * 1000, "000.000") & Space(7) & Xi & Space(15) & Yi & Space(22)
Next i



End Sub

⌨️ 快捷键说明

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