📄 frmarthorizon.frm
字号:
VERSION 5.00
Begin VB.Form frmArtHorizon
BackColor = &H8000000C&
BorderStyle = 1 'Fixed Single
Caption = "Artificial Horizon"
ClientHeight = 6855
ClientLeft = 45
ClientTop = 330
ClientWidth = 6945
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 457
ScaleMode = 3 'Pixel
ScaleWidth = 463
StartUpPosition = 3 'Windows Default
Begin VB.Line MoveBar
BorderWidth = 220
DrawMode = 6 'Mask Pen Not
X1 = 114
X2 = 334
Y1 = 334
Y2 = 334
End
Begin VB.Line Line1
BorderColor = &H00800000&
BorderWidth = 2
Index = 13
X1 = 232
X2 = 248
Y1 = 252
Y2 = 252
End
Begin VB.Line Line1
BorderColor = &H00800000&
BorderWidth = 2
Index = 12
X1 = 200
X2 = 216
Y1 = 252
Y2 = 252
End
Begin VB.Line Line1
BorderColor = &H00800000&
BorderWidth = 2
Index = 11
X1 = 232
X2 = 272
Y1 = 243
Y2 = 243
End
Begin VB.Line Line1
BorderColor = &H00800000&
BorderWidth = 2
Index = 10
X1 = 176
X2 = 216
Y1 = 243
Y2 = 243
End
Begin VB.Line Line1
BorderColor = &H00800000&
BorderWidth = 2
Index = 9
X1 = 232
X2 = 248
Y1 = 233
Y2 = 233
End
Begin VB.Line Line1
BorderColor = &H00800000&
BorderWidth = 2
Index = 8
X1 = 200
X2 = 216
Y1 = 233
Y2 = 233
End
Begin VB.Line Line1
BorderColor = &H00800000&
BorderWidth = 2
Index = 7
X1 = 232
X2 = 304
Y1 = 224
Y2 = 224
End
Begin VB.Line Line1
BorderColor = &H00800000&
BorderWidth = 2
Index = 6
X1 = 144
X2 = 216
Y1 = 224
Y2 = 224
End
Begin VB.Line Line1
BorderColor = &H00800000&
BorderWidth = 2
Index = 5
X1 = 232
X2 = 248
Y1 = 214
Y2 = 214
End
Begin VB.Line Line1
BorderColor = &H00800000&
BorderWidth = 2
Index = 4
X1 = 200
X2 = 216
Y1 = 214
Y2 = 214
End
Begin VB.Line Line1
BorderColor = &H00800000&
BorderWidth = 2
Index = 3
X1 = 232
X2 = 272
Y1 = 204
Y2 = 204
End
Begin VB.Line Line1
BorderColor = &H00800000&
BorderWidth = 2
Index = 2
X1 = 176
X2 = 216
Y1 = 204
Y2 = 204
End
Begin VB.Line Line1
BorderColor = &H00800000&
BorderWidth = 2
Index = 1
X1 = 232
X2 = 248
Y1 = 195
Y2 = 195
End
Begin VB.Line Line1
BorderColor = &H00800000&
BorderWidth = 2
Index = 0
X1 = 200
X2 = 216
Y1 = 195
Y2 = 195
End
Begin VB.Shape Sky
BorderColor = &H00C0C0C0&
BorderWidth = 2
FillColor = &H00FFFF80&
FillStyle = 0 'Solid
Height = 3300
Left = 1710
Shape = 3 'Circle
Top = 1710
Width = 3300
End
Begin VB.Shape Background
BorderColor = &H00C0C0C0&
BorderWidth = 2
FillColor = &H80000011&
FillStyle = 0 'Solid
Height = 3900
Left = 1410
Shape = 3 'Circle
Top = 1410
Width = 3900
End
End
Attribute VB_Name = "frmArtHorizon"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Const Pi As Double = 3.141592
Const W2 As Double = 1.4142
Const MX As Integer = 224
Const MY As Integer = 224
Const R As Integer = 110
Private Sub Form_Load()
frmArtHorizon.Top = 4100
frmArtHorizon.Left = 8100
End Sub
Function CalculateBar(a, b As Double)
Static HX1 As Single, HY1 As Single, HX2 As Single, HY2 As Single
Static alpha As Double, beta As Double, gamma As Double, delta As Double
Static cosa As Double, sina As Double, sinb As Double
'Conversion to Radian
'alpha = a * Pi / 180: beta = b * Pi / 180
alpha = a: beta = b
'Preprocessing
gamma = alpha - 0.75 * Pi: delta = alpha - 0.25 * Pi
cosa = Cos(alpha): sina = Sin(alpha): sinb = Sin(beta)
HX1 = MX + R * (W2 * Cos(gamma) + sinb * sina)
HY1 = MY - (R * (W2 * Sin(gamma) - sinb * cosa))
HX2 = MX + R * (W2 * Cos(delta) + sinb * sina)
HY2 = MY - R * (W2 * Sin(delta) - sinb * cosa)
Call VisualizeBar(HX1, HY1, HX2, HY2)
End Function
Function VisualizeBar(X1, Y1, X2, Y2 As Single)
MoveBar.X1 = X1
MoveBar.Y1 = Y1
MoveBar.X2 = X2
MoveBar.Y2 = Y2
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -