📄 yundongfangzhen.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "comdlg32.ocx"
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1
BackColor = &H80000009&
Caption = "船舶旋回仿真"
ClientHeight = 6990
ClientLeft = 165
ClientTop = 555
ClientWidth = 8100
DrawWidth = 10
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 123.296
ScaleMode = 6 'Millimeter
ScaleWidth = 142.875
Begin MSComctlLib.Toolbar Toolbar1
Align = 1 'Align Top
Height = 360
Left = 0
TabIndex = 8
Top = 0
Width = 8100
_ExtentX = 14288
_ExtentY = 635
ButtonWidth = 609
Appearance = 1
Style = 1
ImageList = "ImageList1"
DisabledImageList= "ImageList1"
HotImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 5
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "edit"
ImageIndex = 1
EndProperty
BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "zuobiao"
ImageIndex = 2
EndProperty
BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "kaishi"
ImageIndex = 3
EndProperty
BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "zanting"
ImageIndex = 4
EndProperty
BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628}
Key = "save"
ImageIndex = 5
EndProperty
EndProperty
End
Begin VB.PictureBox Picture1
BackColor = &H00FFFFFF&
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 5669
Left = 0
Picture = "yundongfangzhen.frx":0000
ScaleHeight = 5610
ScaleWidth = 5610
TabIndex = 0
Top = 360
Width = 5669
Begin MSComctlLib.ImageList ImageList1
Left = 3120
Top = 1080
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 5
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "yundongfangzhen.frx":30A56
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "yundongfangzhen.frx":30DF0
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "yundongfangzhen.frx":3118A
Key = ""
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "yundongfangzhen.frx":31524
Key = ""
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "yundongfangzhen.frx":318BE
Key = ""
EndProperty
EndProperty
End
Begin VB.Timer Timer2
Enabled = 0 'False
Interval = 100
Left = 120
Top = 840
End
Begin VB.CommandButton Command1
BackColor = &H00FF8080&
Caption = "暂停"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2760
Style = 1 'Graphical
TabIndex = 7
Top = 0
Width = 615
End
Begin VB.CommandButton Command2
BackColor = &H00FF8080&
Caption = "轨迹"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 720
Style = 1 'Graphical
TabIndex = 6
Top = 0
Width = 495
End
Begin VB.CommandButton Command4
BackColor = &H00FF8080&
Caption = "停止并保存数据"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1200
MaskColor = &H00FF8080&
Style = 1 'Graphical
TabIndex = 5
Top = 0
Width = 1575
End
Begin VB.CommandButton Command3
BackColor = &H00FF8080&
Caption = "坐标系"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 0
MaskColor = &H00FF8080&
Style = 1 'Graphical
TabIndex = 4
Top = 0
Width = 735
End
Begin VB.TextBox Text2
BackColor = &H80000008&
BorderStyle = 0 'None
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 255
Left = 8880
MultiLine = -1 'True
TabIndex = 3
Top = 0
Width = 2655
End
Begin VB.TextBox Text1
BackColor = &H80000008&
BorderStyle = 0 'None
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 255
Left = 6240
MultiLine = -1 'True
TabIndex = 2
Top = 0
Width = 2655
End
Begin VB.TextBox Text7
BackColor = &H80000006&
BorderStyle = 0 'None
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFFFF&
Height = 255
Left = 3600
MultiLine = -1 'True
TabIndex = 1
Top = 0
Width = 2655
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 1320
Top = 2040
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
End
Begin VB.Menu 参数设置
Caption = "参数设置(&E)"
Index = 1
End
Begin VB.Menu 生成坐标系
Caption = "生成坐标系(&G)"
Index = 2
End
Begin VB.Menu 开始
Caption = "开始(&S) "
Index = 4
End
Begin VB.Menu 暂停
Caption = "暂停(&P)"
Index = 5
End
Begin VB.Menu 停止并保存数据
Caption = "停止并保存数据(&S)"
Index = 6
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim s1 As String
Dim zhuantoujiao As Double
Private Sub Command1_Click()
Timer2.Enabled = False
End Sub
Private Sub Command2_Click()
X1 = 0
Y1 = 0
Timer2.Enabled = True
End Sub
Private Sub Command3_Click()
Picture1.Scale (-Val(Dialog.Text6.Text), Val(Dialog.Text6.Text))-(Val(Dialog.Text6.Text), -Val(Dialog.Text6.Text))
Dialog.Text6.Text = Dialog.Text6.Text
Picture1.Line (-Val(Dialog.Text6.Text), 0)-(Val(Dialog.Text6.Text), 0)
Picture1.Line (0, -Val(Dialog.Text6.Text))-(0, Val(Dialog.Text6.Text))
Dialog.Text6.Enabled = False
End Sub
Private Sub Command4_Click()
Timer2.Enabled = False
s = "Data type(*.txt)|*.txt" & "|Data type(*.wri)|*.wri" & "|Data type(*.xls)|*.xls"
CommonDialog1.Filter = s
CommonDialog1.Action = 2
f = FreeFile
Open CommonDialog1.FileName For Output As #f
Print #f, s1
Close #f
End
End Sub
Private Sub Form_Resize()
Picture1.Width = Me.Width
Picture1.Height = Me.Height
End Sub
Private Sub Timer2_Timer()
Static t, X1, Y1
zhuantoujiao = Val(Dialog.Text1.Text) * Val(Dialog.Text4.Text) * (t - Val(Dialog.Text2.Text) + Exp(-t / Val(Dialog.Text2.Text)))
X1 = X1 + Val(Dialog.Text5.Text) * Cos(zhuantoujiao * 3.14 / 180)
Y1 = Y1 + Val(Dialog.Text5.Text) * Sin(zhuantoujiao * 3.14 / 180)
Picture1.PSet (X1, Y1), RGB(100, 255, 100)
t = t + 1
If zhuantoujiao <= 360 Then
s1 = s1 + "纵距:" + Str(X1) + " " + "横距:" + Str(Y1) + " " + "转头角:" + Str(zhuantoujiao) + vbCr + vbLf
Text7.Text = "转头角:" + Str(zhuantoujiao) + vbCr + vbLf
Else
s1 = s1 + "纵距:" + Str(X1) + " " + "横距:" + Str(Y1) + " " + "转头角:" + Str((zhuantoujiao) Mod 360) + vbCr + vbLf
Text7.Text = "转头角:" + Str((zhuantoujiao) Mod 360#) + vbCr + vbLf
End If
Text1.Text = "横距:" + Str(X1) + vbCr + vbLf
Text2.Text = "纵距:" + Str(Y1) + vbCr + vbLf
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
On Error Resume Next
Select Case Button.Key
Case "edit"
Dialog.Show
Case "zuobiao"
Picture1.Scale (-Val(Dialog.Text6.Text), Val(Dialog.Text6.Text))-(Val(Dialog.Text6.Text), -Val(Dialog.Text6.Text))
Dialog.Text6.Text = Dialog.Text6.Text
Picture1.Line (-Val(Dialog.Text6.Text), 0)-(Val(Dialog.Text6.Text), 0)
Picture1.Line (0, -Val(Dialog.Text6.Text))-(0, Val(Dialog.Text6.Text))
Dialog.Text6.Enabled = False
Case "kaishi"
X1 = 0
Y1 = 0
Timer2.Enabled = True
Case "zanting"
Timer2.Enabled = False
Case "save"
Timer2.Enabled = False
s = "Data type(*.txt)|*.txt" & "|Data type(*.wri)|*.wri" & "|Data type(*.xls)|*.xls"
CommonDialog1.Filter = s
CommonDialog1.Action = 2
f = FreeFile
Open CommonDialog1.FileName For Output As #f
Print #f, s1
Close #f
End
End Select
End Sub
Private Sub 参数设置_Click(Index As Integer)
Dialog.Show
End Sub
Private Sub 开始_Click(Index As Integer)
X1 = 0
Y1 = 0
Timer2.Enabled = True
End Sub
Private Sub 生成坐标系_Click(Index As Integer)
Picture1.Scale (-Val(Dialog.Text6.Text), Val(Dialog.Text6.Text))-(Val(Dialog.Text6.Text), -Val(Dialog.Text6.Text))
Dialog.Text6.Text = Dialog.Text6.Text
Picture1.Line (-Val(Dialog.Text6.Text), 0)-(Val(Dialog.Text6.Text), 0)
Picture1.Line (0, -Val(Dialog.Text6.Text))-(0, Val(Dialog.Text6.Text))
Dialog.Text6.Enabled = False
End Sub
Private Sub 停止并保存数据_Click(Index As Integer)
Timer2.Enabled = False
s = "Data type(*.txt)|*.txt" & "|Data type(*.wri)|*.wri" & "|Data type(*.xls)|*.xls"
CommonDialog1.Filter = s
CommonDialog1.Action = 2
f = FreeFile
Open CommonDialog1.FileName For Output As #f
Print #f, s1
Close #f
End
End Sub
Private Sub 暂停_Click(Index As Integer)
Timer2.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -