📄 frmmain.frm
字号:
StatusBar1.Panels(1).Text = "文件——" & Item.ToolTipText
End Sub
Private Sub m_v_v_Click(Index As Integer)
SSTab1.Tab = Index
SSTab1_Click Index
End Sub
Private Sub m_w_j_Click()
JianDing
End Sub
Private Sub m_w_print_Click()
FPrintView
End Sub
Private Sub m_w_t_Click()
Fcomm
End Sub
Private Sub Option1_Click(Index As Integer)
mPic.Cls
drawYt mPic, Index
End Sub
Private Sub PicMain_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim curx As Single, curY As Single, curWidth As Single, curHeight As Single
If PicFlag = 3 Then
Line1.BorderWidth = 2
Line1.BorderColor = vbBlack
curx = 0
curWidth = PicMain.Width
curY = PicMain.Height * 0.9
curHeight = PicMain.Height * 0.8
If X >= curx And X <= curx + curWidth And Y >= (curY - curHeight) And Y <= curY Then
Line1.Visible = True
Line1.x1 = X
Line1.x2 = X
Line1.y1 = curY - curHeight
Line1.y2 = curY
curPiont = xToIndex(X, 3)
drawPiont curPiont, 3
'------------------------------------071114
LbDisplay.Visible = True
showLab curPiont, 3
LbDisplay.Top = (curY - curHeight - LbDisplay.Height)
LbDisplay.Left = IIf(X + LbDisplay.Width > curx + curWidth, X - LbDisplay.Width - 50, X + 50)
'------------------------------------
Else
LbDisplay.Visible = False
Line1.Visible = False
End If
End If
End Sub
Private Sub PicMain_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim curx As Single, curY As Single, curWidth As Single, curHeight As Single
If PicFlag = 1 Then
Line1.BorderWidth = 1
Line1.BorderColor = vbBlue
curx = PicMain.Width * ytx
curY = PicMain.Height * yty
curWidth = PicMain.Width * ytw
curHeight = PicMain.Height * yth
If X >= curx And X <= curx + curWidth And Y >= (curY - curHeight) And Y <= curY Then
Line1.Visible = True
Line1.x1 = X
Line1.x2 = X
Line1.y1 = curY - curHeight
Line1.y2 = curY
curPiont = xToIndex(X, 1)
drawPiont curPiont, 1
' drawmsg X & "----" & PicMain.ScaleWidth & "---" & curHeight
listData.ListItems(curPiont).Selected = True
listData.ListItems(curPiont).EnsureVisible
'------------------------------------071114
LbDisplay.Visible = True
showLab curPiont, 1
LbDisplay.Top = (curY - curHeight)
LbDisplay.Left = IIf(X + LbDisplay.Width > curx + curWidth, X - LbDisplay.Width - 50, X + 50)
'------------------------------------
Else
LbDisplay.Visible = False
Line1.Visible = False
End If
End If
End Sub
Private Sub SSTab1_Click(PreviousTab As Integer)
Dim i As Integer
'清除绘图区
mPic.Cls
picDis.Cls
Line1.Visible = False
'pic置前
If SSTab1.Tab = 3 Then
' mPic.Visible = False
mPic.ZOrder 1
Else
' mPic.Visible = True
SSTab1.ZOrder 1
End If
'设置菜单
For i = 0 To 3
If i = SSTab1.Tab Then
m_v_v(i).Checked = True
Else
m_v_v(i).Checked = False
End If
Next
If Not TempDmyData.ReadSuc Then Exit Sub
PicFlag = SSTab1.Tab + 1
Command3.Enabled = False
Select Case PicFlag
Case 1 '液面套压
Option1(2).Value = True
drawYt mPic
StatusBar1.Panels(1).Text = "视图——液面套压"
Case 2 '静液面
drawmsg "注意:需添加正确油层中深和含水,单击确定,才会显示正确的图像"
Command3.Enabled = True
'-----------------------------
txtHs.Text = TempDmyData.hanshui
txtZs.Text = TempDmyData.zhongshen
GetJpress CInt(TempDmyData.zhongshen), CInt(TempDmyData.hanshui)
drawJp mPic
'-----------------------------
StatusBar1.Panels(1).Text = "视图——静压图"
Case 3 '
If Not TempDmyData.HaveDym Then
MsgBox "没有高低频数据!!!"
SSTab1.Tab = PreviousTab
Else
HScroll1.Max = 1
HScroll1.Min = 1
HScroll1.Value = 1
VScroll1.Value = 0
FreqDisPlay = UBound(TempDmyData.dmyHL())
drawFrequency mPic, HScroll1.Value, , FreqDisPlay
StatusBar1.Panels(1).Text = "视图——动液面"
End If
Case 4
drawmsg "注意:报表需保存后打印才会显示,清空会清除报表信息"
For i = 1 To 35
Text1(i - 1).Text = TempDmyData.dmyRep(i + 2) 'Trim(Text1(i - 1).Text)
Next
StatusBar1.Panels(1).Text = "视图——报表"
End Select
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Index
Case 1 'comm
Fcomm
Case 2
Case 3 'open
FOpenfile
Case 4 'close
FClose
Case 5
FMergeData
Case 7
JianDing
Case 8
FPrintView
Case 10
FExit
End Select
End Sub
Private Sub w_tx_Click()
Fcomm
End Sub
'设置窗体
Sub setForm()
SSTab1.Tab = 0
SSTab1_Click 0
If TempDmyData.ReadSuc Then
SSTab1.Enabled = True
mPic.Enabled = True
Else
mPic.Enabled = False
SSTab1.Enabled = False
End If
StatusBar1.Panels(1).Text = "主界面"
setListData listData
setTitle
End Sub
Sub FPrintView()
If TempDmyData.ReadSuc Then
frmPreview.Show 1
Else
MsgBox "请先打开数据文件!!!"
End If
End Sub
'退出
Sub FExit()
End
End Sub
'打开文件
Public Sub FOpenfile(Optional fileName As String)
If fileName = "" Then
mDialog.DialogTitle = "打开数据文件"
mDialog.Filter = "文件 (*.dmy)|*.dmy"
mDialog.Flags = cdlOFNFileMustExist
mDialog.fileName = ""
mDialog.DefaultExt = "dmy"
mDialog.InitDir = App.Path 'getdefaultpath_load
mDialog.ShowOpen
fileName = Trim(mDialog.fileName)
End If
If fileName <> "" Then
addList fileName
TempDmyData = openFile(fileName)
FreqDisPlay = 0
Me.Caption = "汇发地面测试仪[" & fileName & "]"
End If
setForm
End Sub
'通讯
Sub Fcomm()
StatusBar1.Panels(1).Text = "通讯——回放数据"
FrmComm.CommFlag = 4
FrmComm.Show 1
StatusBar1.Panels(1).Text = "主界面"
End Sub
'关闭文件
Sub FClose()
If mList.ListItems.Count > 0 Then
delList mList.SelectedItem.ToolTipText
If mList.ListItems.Count > 0 Then
FOpenfile (mList.ListItems(1).ToolTipText)
setListFocus 1
Else
TempDmyData.ReadSuc = False
End If
End If
setForm
End Sub
'合并
Sub FMergeData()
StatusBar1.Panels(1).Text = "文件——合并文件"
FrmMerge.Show 1
StatusBar1.Panels(1).Text = "主界面"
End Sub
'设置表头
Sub setTitle()
Dim curx As Single, curY As Single, curWidth As Single, curHeight As Single '绘图区域
Dim rowHeigh As Single, rowWidth As Single
Dim tempStr(6) As String
Dim i As Integer, j As Integer
picTitle.Cls
curx = picTitle.Width * 0.05
curWidth = picTitle.Width * 0.9
curY = picTitle.Height
curHeight = picTitle.Height
rowHeigh = curHeight / 2
rowWidth = curWidth / 3
If TempDmyData.ReadSuc Then
tempStr(1) = "井 号:" & TempDmyData.dmyHead(1)
tempStr(2) = "日 期:" & TempDmyData.dmyHead(2)
tempStr(3) = "时 间:" & TempDmyData.dmyHead(3)
tempStr(4) = "关井液深:" & TempDmyData.dmyHead(5)
tempStr(5) = "关井套压:" & TempDmyData.dmyHead(6)
tempStr(6) = "声 速:" & TempDmyData.dmyHead(7)
Else
tempStr(1) = "井 号:"
tempStr(2) = "日 期:"
tempStr(3) = "时 间:"
tempStr(4) = "关井液深:"
tempStr(5) = "关井套压:"
tempStr(6) = "声 速:"
End If
For i = 1 To 3
For j = 1 To 2
picTitle.CurrentX = curx + rowWidth * (i - 1)
picTitle.CurrentY = rowHeigh * (j - 1) + picTitle.TextHeight(tempStr(3 * (j - 1) + i)) / 2
picTitle.Print tempStr(3 * (j - 1) + i)
Next
Next
End Sub
Sub drawPiont(sPiont As Long, dFlag As Integer)
Dim curx As Single, curY As Single, curWidth As Single, curHeight As Single '绘图区域
Dim rowHeigh As Single, rowWidth As Single
Dim strTemp(4) As String
Dim i As Integer
picDis.Cls
curx = picDis.Width * 0.05
curWidth = picDis.Width * 0.9
curY = picDis.Height
curHeight = picDis.Height
rowWidth = curWidth / 4
Select Case dFlag
Case 1
strTemp(1) = "当前点数:" & sPiont
strTemp(2) = "液面深度:" & TempDmyData.dmyYT(sPiont, 2)
strTemp(3) = "套 压:" & TempDmyData.dmyYT(sPiont, 3)
strTemp(4) = "当前时间:" & Format(DateAdd("s", TempDmyData.dmyYT(sPiont, 1), TempDmyData.dmyHead(2) & " " & TempDmyData.dmyHead(3)), "YYYY年MM月DD日 HH:MM")
Case 3
strTemp(1) = "当前点数:" & sPiont
strTemp(2) = ""
strTemp(3) = "液面深度:" & sPiont / 1000 * CLng(TempDmyData.dmyHead(7))
strTemp(4) = ""
End Select
For i = 1 To 4
picDis.CurrentX = curx + rowWidth * (i - 1)
picDis.CurrentY = rowHeigh + picDis.TextHeight(strTemp(i)) / 2
picDis.Print strTemp(i)
Next
End Sub
Sub showLab(sPiont As Long, dFlag As Integer)
Dim strTemp As String
strTemp = ""
Select Case dFlag
Case 1
strTemp = strTemp & "当前点数:" & sPiont & Chr(13)
strTemp = strTemp & "液面深度:" & TempDmyData.dmyYT(sPiont, 2) & Chr(13)
strTemp = strTemp & "套 压:" & TempDmyData.dmyYT(sPiont, 3) & Chr(13)
strTemp = strTemp & "当前时间:" & Format(DateAdd("s", TempDmyData.dmyYT(sPiont, 1), TempDmyData.dmyHead(2) & " " & TempDmyData.dmyHead(3)), "YYYY年MM月DD日 HH:MM")
Case 3
strTemp = strTemp & "当前点数:" & sPiont & Chr(13)
strTemp = strTemp & "液面深度:" & sPiont / 1000 * CLng(TempDmyData.dmyHead(7))
End Select
LbDisplay.Caption = strTemp
End Sub
Sub drawmsg(strMsg As String)
Dim curx As Single, curY As Single, curWidth As Single, curHeight As Single '绘图区域
Dim oldColor As Long
picDis.Cls
curx = picDis.Width * 0.05
curWidth = picDis.Width * 0.9
curY = picDis.Height
oldColor = picDis.ForeColor
picDis.ForeColor = vbRed
picDis.CurrentX = curx + (curWidth - picDis.TextWidth(strMsg)) / 2
picDis.CurrentY = (curY - picDis.TextHeight(strMsg)) / 2
picDis.Print strMsg
picDis.ForeColor = oldColor
End Sub
Function xToIndex(sX As Single, dFlag As Integer) As Long
Dim i As Long
If dFlag = 1 Then
For i = UBound(TempDmyData.dmyYT) To 1 Step -1
If sX > CSng(TempDmyData.dmyYT(i, 4)) Then
xToIndex = i
Exit Function
Else
' Debug.Print i
End If
Next
End If
If dFlag = 3 Then
' xToIndex = CLng(sX * TempDmyData.HLRowPiont / PicMain.Width)
For i = HScroll1.Value + FreqDisPlay - 1 To HScroll1.Value Step -1
If sX > CSng(TempDmyData.dmyHL(i, 3)) Then
xToIndex = i
Exit Function
End If
Next
End If
End Function
Private Sub VScroll1_Change()
If VScroll1.Value = 0 Then
FreqDisPlay = UBound(TempDmyData.dmyHL)
HScroll1.Max = 1
HScroll1.LargeChange = 1
StatusBar1.Panels(1).Text = "视图——动液面"
Else
FreqDisPlay = UBound(TempDmyData.dmyHL) / (2 * Abs(VScroll1.Value))
HScroll1.Max = UBound(TempDmyData.dmyHL) - FreqDisPlay
HScroll1.LargeChange = FreqDisPlay
StatusBar1.Panels(1).Text = "视图——动液面(" & 2 * Abs(VScroll1.Value) & "倍)"
End If
'Me.Caption = VScroll1.Value
If HScroll1.Value <> 1 Then '
HScroll1.Value = 1
Else
mPic.Cls
drawFrequency mPic, HScroll1.Value, , FreqDisPlay
End If
If Line1.Visible Then
curPiont = xToIndex(Line1.x1, 3)
drawPiont curPiont, 3
showLab curPiont, 3
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -