以下是引用片段: 其关键代码如下: Option Explicit '--------------------窗体移动变量 Dim intOldX As Integer Dim intOldy As Integer Dim boolMouseFlag As Boolean Private Sub btnAdd_Click() Dim sql As String '调用数据库连接过程 Call OpenConn '执行查询sql语句 sql = "SELECT * FROM route WHERE name = '" & Text2.Text & "路'" rs.Open sql, cn Text1.Text = "" '读取记录集内容 While Not rs.EOF '将记录输出到窗体上 Text1.Text = Text1.Text & vbCrLf & vbCrLf & rs("name") & vbCrLf & vbCrLf & rs("content") rs.MoveNext Wend '调用数据库关闭过程 Call CloseConn End Sub
Private Sub Form_Resize() '窗体外观 Call FormFace(Me, Me.TopPicture, Me.KKShape) Call TopCaption(Me.TopPicture, Me.Label2(3).Caption) 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
|