📄 form1.frm
字号:
BackColor = -2147483643
ImageWidth = 16
ImageHeight = 16
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 7
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":5BE6
Key = "Drawing"
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":5CF8
Key = "View Details"
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":5E0A
Key = "Print"
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":5F1C
Key = "Help"
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":602E
Key = "Delete"
EndProperty
BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":6140
Key = ""
EndProperty
BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Form1.frx":6471
Key = ""
EndProperty
EndProperty
End
Begin MSChart20Lib.MSChart MSChart1
Height = 9450
Left = 3225
OleObjectBlob = "Form1.frx":67C3
TabIndex = 6
Top = 2055
Width = 12540
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "Label4"
Height = 165
Left = 0
TabIndex = 9
Top = 0
Visible = 0 'False
Width = 1755
End
Begin VB.Label Label2
BorderStyle = 1 'Fixed Single
Caption = " "
Height = 255
Left = 2550
TabIndex = 4
Top = 555
Width = 3135
End
Begin VB.Label Label1
BorderStyle = 1 'Fixed Single
Caption = " 请选择传感器:"
Height = 255
Left = 0
TabIndex = 3
Top = 555
Width = 2535
End
Begin VB.Line Line1
X1 = 0
X2 = 15240
Y1 = 480
Y2 = 480
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As New Connection
Dim rs As New Recordset
Dim sKey, trvkey As String
Dim tipmschart1 As New clsToolTip
Private Declare Function timeGetTime Lib "winmm.dll" () As Long
Private Sub biaoge()
Dim time1, time2 As Long
Dim m As Integer
setxianshi ("grid")
time1 = timeGetTime
sqlstr = "select * from xia_dayreport where ttid = '" & sKey & "' and left(tttime,10) = '2007-08-07' order by tttime"
rs.Open sqlstr, conn, adOpenStatic
m = rs.RecordCount
Set VSFG1.DataSource = rs
VSFG1.Rows = m
setxianshi ("grid")
VSFG1.ColWidth(0) = "300"
For i = 1 To 8
VSFG1.ColAlignment(i) = flexAlignCenterCenter
Next i
VSFG1.TextMatrix(0, 1) = "序号"
VSFG1.TextMatrix(0, 2) = "档案名称"
VSFG1.TextMatrix(0, 3) = "科目"
VSFG1.TextMatrix(0, 4) = "项目"
VSFG1.TextMatrix(0, 5) = "分类"
VSFG1.TextMatrix(0, 6) = "部门"
VSFG1.TextMatrix(0, 7) = "客户"
VSFG1.TextMatrix(0, 8) = "员工"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''MSFLEXGRID使用示例'''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Option Explicit
' Private Sub Combo1_Click()
' MSFlexGrid1.text = Combo1.text
' End Sub
' Private Sub Combo1_KeyPress(KeyAscii As Integer)
' If KeyAscii = vbKeyEscape Then
' Combo1.Visible = False
' MSFlexGrid1.SetFocus
' Exit Sub
' End If
' If KeyAscii = vbKeyReturn Then
' MSFlexGrid1.text = Combo1.text
' Combo1.Visible = False
' MSFlexGrid1.SetFocus
' End If
' End Sub
' Private Sub Combo1_LostFocus()
' Combo1.Visible = False
' MSFlexGrid1.SetFocus
' Exit Sub
' End Sub
' Private Sub Form_Load()
' Dim i As Integer
' Dim width, text, Archives
' width = Array("400", "2100", "800", "800", "800", "800", "800", "800", "800","800", "800")
' text = Array("序号", "档案名称", "第1级", "第2级", "第3级", "第4级", "第5级", "第6级", "第7级", "第8级", "第9级")
' Archives = Array("null", "科目", "项目分类", "固定资产分类", "部门分类", "员工分类", "供应商分类", "客户分类", "销售商分类", "地区分类", "出入库类别", "存货分类", "预留12", "预留13", "预留14", "预留15", "预留16", "预留17", "预留18", "预留19","预留20")
' With MSFlexGrid1
' .Rows = 21
' .Cols = 11
' .FixedCols = 2
' .FixedRows = 1
' End With
' For i = 1 To 9
' Combo1.AddItem i
' Next i
' For i = 0 To 10
' MSFlexGrid1.ColWidth(i) = width(i)
' MSFlexGrid1.TextMatrix(0, i) = text(i)
' Next i
' For i = 1 To 20
' With MSFlexGrid1
' .TextMatrix(i, 0) = i
' .TextMatrix(i, 1) = Archives(i)
' .RowHeight(i) = 300
' End With
' Next i
' End Sub
' Private Sub MSFlexGrid1_Click()
' Dim c As Integer, r As Integer
' With MSFlexGrid1
' c = .col
' r = .row
' If c > 1 And r > 0 Then
' Combo1.Left = .Left + .ColPos(c) + 50
' Combo1.Top = .Top + .RowPos(r) + 50
' Combo1.width = .ColWidth(c)
' Combo1.text = .text
' Combo1.Visible = True
' Combo1.SetFocus
' End If
' End With
' End Sub
' Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
' If KeyAscii = vbKeyReturn Then
' Call MSFlexGrid1_Click
' End If
' End Sub
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rs.Close
time2 = timeGetTime
Label2.Caption = time2 - time1 & "毫秒 共有" & m & "条记录"
Toolbar1.Buttons.Item(5).Enabled = True
End Sub
Private Sub prt()
Dim time1, time2 As Long
time1 = timeGetTime
VSFG1.ColWidth(0) = "0"
setxianshi ("prt")
VSPrinter1.MarginTop = mtop
VSPrinter1.MarginBottom = mbottom
VSPrinter1.MarginLeft = mleft
VSPrinter1.MarginRight = mright
VSPrinter1.StartDoc
VSPrinter1.FontSize = 24
VSPrinter1.FontBold = True
VSPrinter1.TextAlign = taCenterMiddle
VSPrinter1.Paragraph = "XX这是标题这是标题"
VSPrinter1.Paragraph = ""
VSPrinter1.Zoom = 100 '显示比例为100%
VSPrinter1.RenderControl = Form1.VSFG1.hWnd
VSPrinter1.EndDoc
time2 = timeGetTime
Label2.Caption = time2 - time1
End Sub
Private Sub cmmset_Click()
Form2.Show
End Sub
Private Sub Form_Load()
Dim node As node
Dim c, c1, c2 As String
Dim sqlstr, key, keyname, key1, keyname1, key2, keyname2 As String
tipmschart1.DelayTime = 2
tipmschart1.VisibleTime = 2000
Form1.KeyPreview = True
VSPrinter1.Visible = False
MSChart1.Visible = False
MSChart1.AllowSeriesSelection = False
VSFG1.Visible = False
VSFG1.Top = 840
VSFG1.Left = 2640
MSChart1.Top = 840
MSChart1.Left = 2640
VSPrinter1.Top = 840
VSPrinter1.Left = 2640
mtop = 900
mbottom = 900
mleft = 900
mright = 900
conn.CursorLocation = adUseClient
With conn
.CommandTimeout = 600
.ConnectionTimeout = 600
End With
'conn.Open "PROVIDER=Microsoft.Jet.OlEDB.4.0;Data Source=" & App.Path & "\COAL.mdb;"
conn.Open "Provider=SQLOLEDB.1;Data Source=LENOVO-D16E7F58;User ID=sa; Password='operator'; Initial Catalog =COAL"
TRV.Nodes.Clear
Set node = TRV.Nodes.Add(, , "boot", "监控探头列表", 1)
sqlstr = "select * from xia_coal"
rs.Open sqlstr, conn, adOpenStatic
m = rs.RecordCount
rs.Close
For i = 1 To m
c = i
sqlstr = "select top " & c & " * from xia_coal"
rs.Open sqlstr, conn, adOpenStatic
rs.MoveLast
key = "K_" & rs.Fields("mkid").Value
keyname = rs.Fields("mkname").Value
Call AddRootNode("boot", key, keyname)
rs.Close
'----------------------------------------------------------------------
'----------------------------------------------------------------------
' sqlstr = "select * from xia_config where mkid = '" & Right(key, Len(key) - 2) & "'"
' rs.Open sqlstr, conn, adOpenStatic
' m1 = rs.RecordCount
' rs.Close
' For j = 1 To m1
' c1 = j
' sqlstr = "select top " & c1 & " * from xia_config where mkid = '" & Right(key, Len(key) - 2) & "'"
' rs.Open sqlstr, conn, adOpenStatic
' rs.MoveLast
' key1 = "K_" & rs.Fields("ttid").Value
' keyname1 = rs.Fields("ttname").Value
' Call AddChildNode(key, key1, keyname1)
' rs.Close
'--------------------------------------------
'--------------------------------------------
' sqlstr = "select * from xia_dayreport where left(ttid,11) = '" & Right(key, Len(key1) - 2) & "' order by right(ttid,2)"
' rs.Open sqlstr, conn, adOpenStatic
' m2 = rs.RecordCount
' rs.Close
' For k = 1 To m2
' c2 = k
' ' sqlstr = "select top " & c2 & " * from xia_dayreport where left(ttid,11) = '" & Right(key, Len(key1) - 2) & "' order by right(ttid,2)"
' rs.Open sqlstr, conn, adOpenStatic
' rs.MoveLast
' key2 = "K_" & rs.Fields("ttid").Value
' keyname2 = rs.Fields("ttid").Value
' Call AddChildNode(key1, key2, keyname2)
' rs.Close
' Next k
'--------------------------------------------
'--------------------------------------------
' Next j
'----------------------------------------------------------------------
'----------------------------------------------------------------------
Next i
node.Expanded = True
Toolbar1.Buttons.Item(5).Enabled = False
Toolbar1.Buttons.Item(6).Enabled = False
Toolbar1.Buttons.Item(7).Enabled = False
End Sub
Sub AddRootNode(ByRef Root_Key, ByRef str_Key, ByRef str_Name)
Dim ndNewNode As node
Set ndNewNode = TRV.Nodes.Add(Root_Key, tvwChild, str_Key, str_Name, 2)
ndNewNode.Expanded = True
End Sub
Sub AddChildNode(ByRef Child, ByRef Child_key, ByRef str_Name)
Dim ndNewNode As node
Set ndNewNode = TRV.Nodes.Add(Child, tvwChild, Child_key, str_Name, 3)
ndNewNode.Expanded = True
End Sub
Private Sub Form_Resize()
TRV.Height = Form1.Height - 1700
VSFG1.Height = Form1.Height - 1700
VSFG1.Width = Form1.Width - 2775
MSChart1.Height = Form1.Height - 1700
MSChart1.Width = Form1.Width - 2775
VSPrinter1.Height = Form1.Height - 1700
VSPrinter1.Width = Form1.Width - 2775
End Sub
Private Sub Form_Unload(Cancel As Integer)
End
End Sub
Private Sub MSChart1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
' Dim whichPart As Integer, whichSeries As Integer
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -