?? frmsetnodelocation.frm
字號:
VERSION 5.00
Begin VB.Form frmSetNodeLocation
Caption = "設置坐標"
ClientHeight = 8055
ClientLeft = 60
ClientTop = 345
ClientWidth = 7320
LinkTopic = "Form1"
ScaleHeight = 8055
ScaleWidth = 7320
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton butConvert16to10
Caption = "16->10"
Height = 615
Left = 4680
TabIndex = 20
Top = 5160
Width = 1215
End
Begin VB.CommandButton butQueryNodeLocation
Caption = "查詢"
Height = 495
Left = 3720
TabIndex = 19
Top = 960
Width = 1215
End
Begin VB.Timer Timer1
Left = 5880
Top = 1920
End
Begin VB.TextBox textNodeAddress
Height = 495
Left = 1080
TabIndex = 17
Top = 720
Width = 1695
End
Begin VB.CommandButton butConvert10to16
Caption = "10->16"
Height = 615
Left = 4680
TabIndex = 12
Top = 4200
Width = 1215
End
Begin VB.TextBox textAfterConverted
Height = 615
Left = 840
TabIndex = 11
Top = 5160
Width = 1575
End
Begin VB.TextBox textBeforeConverted
Height = 615
Left = 840
TabIndex = 10
Top = 4200
Width = 1575
End
Begin VB.CommandButton butSetNodeLocation
Caption = "設置"
Height = 495
Left = 3720
TabIndex = 8
Top = 1680
Width = 1215
End
Begin VB.CommandButton butCancel
Caption = "退出"
Height = 495
Left = 3720
TabIndex = 7
Top = 2400
Width = 1215
End
Begin VB.TextBox textZ
Height = 495
Left = 1080
TabIndex = 6
Top = 2520
Width = 1695
End
Begin VB.TextBox textY
Height = 495
Left = 1080
TabIndex = 5
Top = 1920
Width = 1695
End
Begin VB.TextBox textX
Height = 495
Left = 1080
TabIndex = 1
Top = 1320
Width = 1695
End
Begin VB.Label Label12
Caption = "RSSI"
Height = 375
Left = 5520
TabIndex = 23
Top = 360
Width = 855
End
Begin VB.Label labrssi
Height = 495
Left = 5640
TabIndex = 22
Top = 960
Width = 1215
End
Begin VB.Label Label11
Caption = "坐標轉換"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 240
TabIndex = 21
Top = 3600
Width = 1935
End
Begin VB.Line Line1
X1 = 0
X2 = 7200
Y1 = 3360
Y2 = 3360
End
Begin VB.Label Label10
Caption = "節點地址"
Height = 375
Left = 120
TabIndex = 18
Top = 840
Width = 855
End
Begin VB.Label Label9
Caption = "0X"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 360
TabIndex = 16
Top = 5160
Width = 375
End
Begin VB.Label Label8
Caption = "在2431中,定位引擎使用高6表示坐標的整數部分,低兩位表示坐標的小數部分"
ForeColor = &H000080FF&
Height = 375
Left = 240
TabIndex = 15
Top = 6120
Width = 6615
End
Begin VB.Label Label7
Caption = "16進制"
Height = 375
Left = 2760
TabIndex = 14
Top = 5280
Width = 1695
End
Begin VB.Label Label6
Caption = "10進制,精確到0.25"
Height = 375
Left = 2760
TabIndex = 13
Top = 4440
Width = 1575
End
Begin VB.Label Label5
Caption = "請檢查串口是否已經正確連接到節點上"
ForeColor = &H000000FF&
Height = 375
Left = 1080
TabIndex = 9
Top = 6720
Width = 3615
End
Begin VB.Label Label4
Caption = "Z"
Height = 375
Left = 600
TabIndex = 4
Top = 2640
Width = 375
End
Begin VB.Label Label3
Caption = "Y"
Height = 375
Left = 600
TabIndex = 3
Top = 2040
Width = 375
End
Begin VB.Label Label2
Caption = "X"
Height = 375
Left = 600
TabIndex = 2
Top = 1440
Width = 375
End
Begin VB.Label Label1
Caption = "請輸入節點的坐標(16進制,不包括0x)"
ForeColor = &H000000FF&
Height = 375
Left = 0
TabIndex = 0
Top = 360
Width = 3375
End
End
Attribute VB_Name = "frmSetNodeLocation"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim timeout As Boolean
Dim isreceived As Boolean
Option Explicit
Private Sub butCancel_Click()
If (MsgBox("確定退出嗎?", vbOKCancel, "Confirm") = vbOK) Then
Unload Me
MainForm.Show
End If
End Sub
Private Sub butConvert10to16_Click()
Dim doubleBeforeConverted As Double
Dim dotpos As Integer
Dim afterdot As Integer ' 00 1 0.25 1 0.5 2 0.75 3
Dim beforedot As Integer
If Trim(textBeforeConverted.Text) = "" Then
MsgBox "請輸入要轉換的坐標", vbOKOnly, "error"
Exit Sub
End If
doubleBeforeConverted = CDbl(Trim(textBeforeConverted.Text))
If doubleBeforeConverted > 63.75 Then
MsgBox "坐標最大為63.75", vbOKOnly, "error"
Exit Sub
End If
dotpos = InStr(textBeforeConverted.Text, ".")
If dotpos = 0 Then
'沒有小數點
afterdot = 0
beforedot = CInt(textBeforeConverted.Text)
Else
'如果有小數點
beforedot = CInt(Left(Trim(textBeforeConverted.Text), dotpos - 1))
If (Len(Trim(textBeforeConverted.Text))) - dotpos = 1 Then
'1位小數
Select Case Right(Trim(textBeforeConverted.Text), 1)
Case "5"
afterdot = 2
Case "0"
afterdot = 0
Case Else
MsgBox "1位小數只能為0.0,0.5", vbOKOnly, "error"
Exit Sub
End Select
ElseIf (Len(Trim(textBeforeConverted.Text))) - dotpos = 2 Then
Select Case Right(Trim(textBeforeConverted.Text), 2)
Case "00"
afterdot = 0
Case "25"
afterdot = 1
Case "50"
afterdot = 2
Case "75"
afterdot = 3
Case Else
MsgBox "2位小數只能為0.00,0.25,0.50,0.75", vbOKOnly, "error"
Exit Sub
End Select
Else
MsgBox "小數點后最多為2位", vbOKOnly, "error"
Exit Sub
End If
End If
textAfterConverted.Text = Hex(beforedot * 4 + afterdot)
End Sub
Private Sub butSetNodeLocation_Click()
Dim strNodeLocationX As String
Dim strNodeLocationY As String
Dim strNodeLocationZ As String
Dim strNodeAddress As String
Dim i As Integer
strNodeAddress = Trim(textNodeAddress)
strNodeLocationX = Trim(textX.Text)
strNodeLocationY = Trim(textY.Text)
strNodeLocationZ = Trim(textZ.Text)
If (strNodeAddress = "") Then
MsgBox "請輸入節點地址", vbOKOnly, "Error"
Exit Sub
End If
If (Len(strNodeAddress) > 2) Then
MsgBox "請輸入正確的節點地址信息(長度小于2)", vbOKOnly, "Error"
Exit Sub
End If
If Not isHex(Left(strNodeAddress, 1)) Then
MsgBox "請輸入正確的節點地址", vbOKOnly, "Error"
Exit Sub
End If
If Not isHex(Right(strNodeAddress, 1)) Then
MsgBox "請輸入正確的節點地址", vbOKOnly, "Error"
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -