⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 VB开发的可以移动控件的源码
💻 FRM
📖 第 1 页 / 共 3 页
字号:
      Height          =   375
      Index           =   9
      Left            =   6840
      TabIndex        =   30
      Top             =   1800
      Width           =   1215
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "运输单位"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   10
      Left            =   240
      TabIndex        =   29
      Top             =   2160
      Width           =   1335
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "规   格"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   11
      Left            =   3480
      TabIndex        =   28
      Top             =   2160
      Width           =   1455
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "毛重(吨)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   12
      Left            =   4920
      TabIndex        =   27
      Top             =   2160
      Width           =   1215
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "皮重(吨)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   13
      Left            =   6120
      TabIndex        =   26
      Top             =   2160
      Width           =   1215
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "扣重(吨)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   14
      Left            =   7320
      TabIndex        =   25
      Top             =   2160
      Width           =   1335
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "净重(吨)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   15
      Left            =   8640
      TabIndex        =   24
      Top             =   2160
      Width           =   1335
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "卸货地点"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   16
      Left            =   240
      TabIndex        =   23
      Top             =   2520
      Width           =   1335
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "单价(¥/T)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   17
      Left            =   240
      TabIndex        =   22
      Top             =   2880
      Width           =   1335
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "金额(元)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   18
      Left            =   2760
      TabIndex        =   21
      Top             =   2880
      Width           =   1215
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      BorderStyle     =   1  'Fixed Single
      Caption         =   "大写(元)"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   375
      Index           =   19
      Left            =   5400
      TabIndex        =   20
      Top             =   2880
      Width           =   1215
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim X1 As Long, Y1 As Long, i, i1 As Long
Dim a As String '标记.拖动的是text还是label
Dim LabClk, TxtClk As String

Private Sub Command1_Click()
Dim path As String
Dim XYHW(159) As Integer
Dim q As Integer
For t = 0 To 19
    With Text1(t)
         XYHW(q) = .Top
        q = q + 1
         XYHW(q) = .Left
        q = q + 1
          XYHW(q) = .Height
        q = q + 1
          XYHW(q) = .Width
        q = q + 1
    End With
Next t
For w = 0 To 19
    With Label1(w)
        XYHW(q) = .Top
        q = q + 1
        XYHW(q) = .Left
        q = q + 1
        XYHW(q) = .Height
        q = q + 1
        XYHW(q) = .Width
        q = q + 1
    End With
Next w

CommonDialog1.CancelError = False
CommonDialog1.Flags = cdlOFNCreatePrompt
CommonDialog1.Filter = "All Files (*.*)|*.*|Text Files" & _
"(*.txt)|*.txt|Batch Files (*.bat)|*.bat"
CommonDialog1.FilterIndex = 2
CommonDialog1.ShowSave
path = CommonDialog1.FileName
Open path For Input As #1
    For e = 0 To 159
        Print #1, , XYHW(e)
        e = e + 1
    Next e
Close #1
    
End Sub

Private Sub Command2_Click()
    For i = 0 To 19
        If Text1(i).Visible = False Then
            Text1(i).Visible = True
        End If
        If Label1(i).Visible = False Then
            Label1(i).Visible = True
        End If
    Next i
End Sub

Private Sub Command3_Click()
     If a = "Text1" Then
        Text1(i).Visible = False
    End If
    If a = "Label1" Then
        Label1(i1).Visible = False
    End If

End Sub

Private Sub Command4_Click()
If a = "Text1" Then
    Text1(i).Top = Text2(0).Text
    Text1(i).Left = Text2(1).Text
    Text1(i).Height = Text2(2).Text
    Text1(i).Width = Text2(3).Text
End If
If a = "Label1" Then
    Label1(i1).Top = Text2(0).Text
    Label1(i1).Left = Text2(1).Text
    Label1(i1).Height = Text2(2).Text
    Label1(i1).Width = Text2(3).Text
End If
End Sub

Private Sub Label1_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
i1 = Index
'If Source.Name = Label1(i1) Then
Label1(i1).Move Label1(i1).Left + X - X1, Label1(i1).Top + Y - Y1
'End If
End Sub

Private Sub Label1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim b As String
i1 = Index
a = "Label1"
Label1(i1).Drag vbBeginDrag
X1 = X
Y1 = Y
End Sub

Private Sub text1_DragDrop(Index As Integer, Source As Control, X As Single, Y As Single)
i = Index
'If Source.Name = Text1(i) Then
Text1(i).Move Text1(i).Left + X - X1, Text1(i).Top + Y - Y1
'End If
End Sub
Private Sub Text1_Mousedown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
i = Index
a = "Text1"
Text1(i).Drag vbBeginDrag
X1 = X
Y1 = Y
End Sub
Private Sub Form_Load()
    Dim strSql As String
If ph <> "" Then
    strSql = "SELECT * From vtrade  where transaction_num='" + ph + "'"
    Adodc1.RecordSource = strSql
    Adodc1.Refresh
End If
End Sub
Private Sub form_DragDrop(Source As Control, X As Single, Y As Single)
'If Source.Name = Text1(i) Then
If a = "Text1" Then
    Text1(i).Move X - X1, Y - Y1
Else
    Label1(i1).Move X - X1, Y - Y1
End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -