📄 form1.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form1
Caption = "HydroInfoSystem"
ClientHeight = 7755
ClientLeft = 60
ClientTop = 450
ClientWidth = 14760
Icon = "Form1.frx":0000
LinkTopic = "Form1"
ScaleHeight = 7755
ScaleWidth = 14760
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton Export
Caption = "分组导出"
Height = 495
Left = 1200
TabIndex = 18
Top = 4320
Width = 1695
End
Begin VB.Frame Frame3
BackColor = &H8000000A&
Caption = "画图"
Height = 1575
Left = 360
TabIndex = 11
Top = 5400
Width = 3615
Begin VB.OptionButton PlotBy
BackColor = &H8000000B&
Caption = "水位"
Height = 495
Index = 0
Left = 480
TabIndex = 14
Top = 480
Width = 1095
End
Begin VB.OptionButton PlotBy
BackColor = &H8000000B&
Caption = "流量"
Height = 495
Index = 1
Left = 1680
TabIndex = 13
Top = 480
Width = 1095
End
Begin VB.ComboBox StationList
Height = 300
Left = 480
TabIndex = 12
Top = 960
Width = 2415
End
End
Begin VB.CommandButton PlotBtn
Caption = "画图"
Height = 495
Left = 1200
TabIndex = 9
Top = 7080
Width = 1695
End
Begin VB.Frame Frame2
BackColor = &H8000000B&
Caption = "查询结果"
Height = 1575
Left = 360
TabIndex = 4
Top = 2640
Width = 3615
Begin VB.TextBox Text3
Height = 495
Left = 120
MultiLine = -1 'True
TabIndex = 6
Top = 840
Width = 1575
End
Begin VB.TextBox Text4
Height = 495
Left = 1800
MultiLine = -1 'True
TabIndex = 5
Top = 840
Width = 1695
End
Begin VB.Label Label3
BackColor = &H8000000B&
Caption = "流量"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1800
TabIndex = 8
Top = 360
Width = 1575
End
Begin VB.Label Label4
BackColor = &H8000000B&
Caption = "水位"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 7
Top = 360
Width = 1695
End
End
Begin VB.CommandButton Query
Caption = "查询"
Height = 495
Left = 1200
TabIndex = 3
Top = 1680
Width = 1695
End
Begin VB.Frame Frame1
BackColor = &H8000000A&
Caption = "查询条件"
Height = 1215
Left = 360
TabIndex = 0
Top = 360
Width = 3615
Begin VB.ComboBox QueryTimeList
Height = 300
Left = 1800
TabIndex = 20
Top = 720
Width = 1695
End
Begin VB.ComboBox QueryStationList
Height = 300
ItemData = "Form1.frx":08CA
Left = 120
List = "Form1.frx":08CC
TabIndex = 19
Top = 720
Width = 1575
End
Begin VB.Label Label1
BackColor = &H8000000B&
Caption = "站点号"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 2
Top = 360
Width = 1695
End
Begin VB.Label Label2
BackColor = &H8000000B&
Caption = "时间"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1800
TabIndex = 1
Top = 360
Width = 1575
End
End
Begin MSComctlLib.ProgressBar ProgressBar1
Height = 375
Left = 360
TabIndex = 17
Top = 4320
Visible = 0 'False
Width = 3615
_ExtentX = 6376
_ExtentY = 661
_Version = 393216
Appearance = 1
End
Begin VB.Label InfoLabel
Alignment = 2 'Center
Height = 255
Left = 120
TabIndex = 16
Top = 5040
Width = 3975
End
Begin VB.Label Label5
Alignment = 2 'Center
BackColor = &H00FFFFFF&
Caption = "欢迎使用HydroInfoSystem!"
BeginProperty Font
Name = "宋体"
Size = 36
Charset = 134
Weight = 700
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000D&
Height = 975
Left = 4680
TabIndex = 15
Top = 3000
Width = 9375
End
Begin VB.OLE OLE1
AutoActivate = 0 'Manual
BackColor = &H00FFFFFF&
Class = "Excel.Chart.8"
Height = 7215
Left = 4200
SizeMode = 1 'Stretch
TabIndex = 10
Top = 360
Width = 10335
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim xlsApp As Excel.Application
Dim xlsWb As Excel.Workbook
Dim xlsWs As Excel.Worksheet
Dim xlsWsNew As Excel.Worksheet
Dim xlsWsExport As Excel.Worksheet
Dim RowUbound(11) As String
Dim i As Double, j As Double, k As Double
Dim StationCode(9) As String
Dim index As Double
Dim rStart, rEnd As Double
Private Sub PlotBtn_Click()
Label5.Visible = False
xlsApp.DisplayAlerts = False
Dim ChartxlsWb As Excel.Workbook
Dim ChartxlsWs As Excel.Worksheet
Dim oChart As Excel.Chart
Set ChartxlsWb = xlsApp.Workbooks.Add
ChartxlsWb.Charts.Add
Set oChart = ChartxlsWb.Charts(1)
If StationList.ListIndex = -1 Then
MsgBox "请选择站点!"
Exit Sub
End If
rStart = RowUbound(StationList.ListIndex) + 1
rEnd = RowUbound(StationList.ListIndex + 1)
j = 0
For i = rStart To rEnd
If PlotBy(0).Value = True Then
If xlsWsNew.Cells(i, 4) = "" Then
j = j + 1
End If
ElseIf PlotBy(1).Value = True Then
If xlsWsNew.Cells(i, 5) = "" Then
j = j + 1
End If
Else
MsgBox "请选择数据源"
Exit Sub
End If
Next
If j / (rEnd - rStart) > 0.5 Then
MsgBox "数据空白!"
ChartxlsWb.SaveAs (App.Path & "\dat\graph.xls")
ChartxlsWb.Close
Exit Sub
End If
With oChart
If PlotBy(0).Value = True Then
.SetSourceData Source:=xlsWsNew.Range("Sheet1!$C$" & rStart & ":$C$" & rEnd & "," & "Sheet1!$D$" & rStart & ":$D$" & rEnd), PlotBy:=xlColumns
ElseIf PlotBy(1).Value = True Then
.SetSourceData Source:=xlsWsNew.Range("Sheet1!$C$" & rStart & ":$C$" & rEnd & "," & "Sheet1!$E$" & rStart & ":$E$" & rEnd), PlotBy:=xlColumns
Else
MsgBox "请选择数据源"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -