📄 form1.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 5745
ClientLeft = 60
ClientTop = 345
ClientWidth = 7110
LinkTopic = "Form1"
ScaleHeight = 5745
ScaleWidth = 7110
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "Command1"
Height = 345
Left = 5790
TabIndex = 4
Top = 1485
Width = 1260
End
Begin VB.CommandButton Command2
Caption = "Command1"
Height = 345
Left = 5790
TabIndex = 3
Top = 825
Width = 1260
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 345
Left = 5775
TabIndex = 2
Top = 225
Width = 1260
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid DataGrid1
Height = 5475
Left = 120
TabIndex = 1
Top = 120
Width = 5325
_ExtentX = 9393
_ExtentY = 9657
_Version = 393216
Rows = 50
Cols = 10
BackColorSel = 32768
BackColorBkg = 16744448
AllowBigSelection= 0 'False
FocusRect = 2
SelectionMode = 1
AllowUserResizing= 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty FontFixed {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_NumberOfBands = 1
_Band(0).Cols = 10
End
Begin MSAdodcLib.Adodc AdoA
Height = 495
Left = 240
Top = 5040
Width = 1200
_ExtentX = 2117
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label1
Caption = "Label1"
Height = 1215
Left = 960
TabIndex = 0
Top = 240
Width = 2175
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim ht(97, 3) As String
Dim A(13) As Integer
'Private Sub Form_Load()
' OpenMdb
'AdoA.ConnectionString = "DBQ=" & App.Path & "\Data\eletricity.Mdb" & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=281;FIL=MS Access;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;PWD=;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;"
'AdoA.RecordSource = "SELECT 用户档案.用户编码, 用户档案.用户名称, 用户档案.本期示数, 用户档案.上期示数,用户档案.倍率,用户档案.本次电量, 用户档案.调整电量, 用户档案.合计电量, 用户档案.电价, 用户档案.调整金额, 用户档案.滞纳金, 用户档案.本次电费, 用户档案.合计电费, 用户档案.台区 FROM 用户档案 ORDER BY 组合编码 ASC"
'AdoA.Refresh
'Set DataGrid1.DataSource = AdoA
' Label1 = LoadResString(101)
'End Sub
Private FormOldWidth As Long
'保存窗体的原始宽度
Private FormOldHeight As Long
'保存窗体的原始高度
'在调用ResizeForm前先调用本函数
Public Sub ResizeInit(FormName As Form)
Dim Obj As Control
FormOldWidth = FormName.ScaleWidth
FormOldHeight = FormName.ScaleHeight
On Error Resume Next
For Each Obj In FormName
Obj.Tag = Obj.Left & " " & Obj.Top & " " & Obj.Width & " " & Obj.Height & " "
Next Obj
On Error GoTo 0
End Sub
'按比例改变表单内各元件的大小,在调用ReSizeForm前先调用ReSizeInit函数
Public Sub ResizeForm(FormName As Form)
Dim Pos(4) As Double
Dim i As Long, TempPos As Long, StartPos As Long
Dim Obj As Control
Dim ScaleX As Double, ScaleY As Double
ScaleX = FormName.ScaleWidth / FormOldWidth
'保存窗体宽度缩放比例
ScaleY = FormName.ScaleHeight / FormOldHeight
'保存窗体高度缩放比例
On Error Resume Next
For Each Obj In FormName
StartPos = 1
For i = 0 To 4
'读取控件的原始位置与大小
TempPos = InStr(StartPos, Obj.Tag, " ", vbTextCompare)
If TempPos > 0 Then
Pos(i) = Mid(Obj.Tag, StartPos, TempPos - StartPos)
StartPos = TempPos + 1
Else
Pos(i) = 0
End If
'根据控件的原始位置及窗体改变大小的比例对控件重新定位与改变大小
Obj.Move Pos(0) * ScaleX, Pos(1) * ScaleY, Pos(2) * ScaleX, Pos(3) * ScaleY
Next i
Next Obj
On Error GoTo 0
End Sub
Private Sub Form_Load()
OpenMdb
AdoA.ConnectionString = "DBQ=" & App.Path & "\Data\eletricity.Mdb" & ";Driver={Microsoft Access Driver (*.mdb)};DriverId=281;FIL=MS Access;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=5;PWD=;SafeTransactions=0;Threads=3;UID=admin;UserCommitSync=Yes;"
AdoA.RecordSource = "SELECT * FROM 操作纪录"
AdoA.Refresh
Set DataGrid1.DataSource = AdoA
Label1 = LoadResString(101)
Call ResizeInit(Me) '在程序装入时必须加入
End Sub
Private Sub Form_Resize()
Call ResizeForm(Me) '确保窗体改变时控件随之改变
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -