以下是引用片段:
Option Explicit '--------------------窗体移动变量 Dim intOldX As Integer Dim intOldy As Integer Dim boolMouseFlag As Boolean
Private Sub btn添加_Click() '调用窗体 frmCgdjMx.UserControl15.Enabled = False frmCgdjMx.Show 1 End Sub
Private Sub ddd_DblClick() '1.当选择一笔业务时,显示其详细的信息(业务信息和商品信息) '注:信息显示模式为调用 Sql Server数据库中的视图 '2.循环显示商品信息 '1 If ddd.TextMatrix(ddd.Row, 0) = "" Then Exit Sub frmCgdjMx.Text2.Tag = Trim(ddd.TextMatrix(ddd.Row, 0)) frmCgdjMx.Text2.Text = Trim(ddd.TextMatrix(ddd.Row, 0)) frmCgdjMx.DTPicker1.Value = Trim(ddd.TextMatrix(ddd.Row, 1)) frmCgdjMx.Text3.Text = Trim(ddd.TextMatrix(ddd.Row, 2)) frmCgdjMx.Text1.Text = Trim(ddd.TextMatrix(ddd.Row, 6)) frmCgdjMx.Text7.Text = Trim(ddd.TextMatrix(ddd.Row, 3)) frmCgdjMx.Text6.Text = Trim(ddd.TextMatrix(ddd.Row, 4)) frmCgdjMx.Text4.Text = Trim(ddd.TextMatrix(ddd.Row, 5)) Dim rs As New ADODB.Recordset '2 Set rs = ExecSql("select * from V_采购登记 where cgid='" & Trim(ddd.TextMatrix(ddd.Row, 0)) & "'") With rs If .RecordCount > 0 Then Dim i As Long Dim ii As Long i = 1 Do Until .EOF For ii = 0 To frmCgdjMx.ddd.Cols - 1 frmCgdjMx.ddd.TextMatrix(i, ii) = " " & Trim(.Fields(ii).Value) Next .MoveNext i = i + 1 Loop End If End With frmCgdjMx.UserControl13.Enabled = False frmCgdjMx.UserControl12.Enabled = False frmCgdjMx.UserControl14.Enabled = False frmCgdjMx.UserControl15.Enabled = True frmCgdjMx.Show 1 End Sub
Private Sub ddd_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) '高亮度显示当前行的内容 Call MoveRow(ddd, ddd.MouseRow) End Sub
Private Sub Form_Activate() '窗体最大化 Me.WindowState = 2 End Sub
Private Sub Form_Load() Call UpdateList End Sub
Private Sub Form_Resize() '动态改变当前窗体的布局和控件内容 Call FormFace(Me, TopPicture, KKShape) Call TopCaption(Me.TopPicture, Label2.Caption) Me.ddd.Move 0, Me.ddd.Top, Me.Width, Me.Height - Me.ddd.Top End Sub
Private Sub TopPicture_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) '准备窗体移动标志 intOldX = X intOldy = Y boolMouseFlag = True End Sub
Private Sub TopPicture_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) '存储窗提议动前的left,top Dim intLeft, intTop As Integer intLeft = Me.Left intTop = Me.Top If Me.WindowState = 2 Then Exit Sub If boolMouseFlag = True Then Me.Left = intLeft + (X - intOldX) Me.Top = intTop + (Y - intOldy) End If End Sub
Private Sub TopPicture_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) '还原当前的窗体移动标志 boolMouseFlag = False End Sub
Public Sub UpdateList() '显示列表的样式和表头 '通过检索数据库找出符合当前条件的记录显示在列表中 '1 Dim arrName() arrName = Array("采购代码", "采购日期", "供应商名称", "总数量", "总金额", "记录人", "备注") Dim arrColwidth() arrColwidth = Array(0, 3000, 3000, 2500, 2000, 2000, 3000) ddd.Cols = 7 ddd.Rows = 2 Dim i As Long For i = 0 To ddd.Cols - 1 ddd.ColWidth(i) = arrColwidth(i) ddd.TextMatrix(0, i) = arrName(i) ddd.TextMatrix(1, i) = "" Next ddd.Rows = 27 '2 Call UpdateDDD(ddd, ExecSql("select cgid, cgrq, khmc, zsl, zje,jlr, bz from cgdj order by cgrq desc ")) End Sub
Private Sub UserControl11_Click() Call UpdateList End Sub
Private Sub UserControl13_Click() '关闭窗体 Unload Me End Sub
|