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

📄 frmb.frm

📁 本人写的一个垃圾代码,主要是实现简单的打印功能
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   180
         Left            =   120
         TabIndex        =   11
         Top             =   4800
         Width           =   5220
      End
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      BackColor       =   &H00C0FFC0&
      ForeColor       =   &H80000008&
      Height          =   7215
      Left            =   120
      ScaleHeight     =   7185
      ScaleWidth      =   5625
      TabIndex        =   0
      Top             =   120
      Width           =   5655
      Begin VB.TextBox txtFrmB 
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H00FFFFC0&
         DataField       =   "编号"
         BeginProperty Font 
            Name            =   "Microsoft Sans Serif"
            Size            =   10.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H000000FF&
         Height          =   330
         Index           =   1
         Left            =   4200
         MousePointer    =   3  'I-Beam
         TabIndex        =   30
         Top             =   2090
         Width           =   855
      End
      Begin VB.TextBox txtFrmB 
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H00C0FFC0&
         DataField       =   "日期"
         BeginProperty Font 
            Name            =   "Microsoft Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00400000&
         Height          =   330
         Index           =   2
         Left            =   3480
         MousePointer    =   3  'I-Beam
         TabIndex        =   22
         Top             =   5800
         Width           =   1815
      End
      Begin VB.TextBox txtFrmB 
         Alignment       =   2  'Center
         Appearance      =   0  'Flat
         BackColor       =   &H00C0FFC0&
         DataField       =   "编号前缀"
         BeginProperty Font 
            Name            =   "Microsoft Sans Serif"
            Size            =   10.5
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00400000&
         Height          =   330
         Index           =   0
         Left            =   2280
         MousePointer    =   3  'I-Beam
         TabIndex        =   4
         Top             =   2090
         Width           =   1935
      End
      Begin TbMenu.VsNetBut cmdPrint 
         Height          =   495
         Left            =   360
         TabIndex        =   32
         Top             =   6360
         Width           =   1335
         _ExtentX        =   2355
         _ExtentY        =   873
         BackColor       =   16761024
         Caption         =   "打   印"
         ButtonPicture   =   "frmB.frx":0000
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         MouseIcon       =   "frmB.frx":077A
      End
      Begin TbMenu.VsNetBut cmdDel 
         Height          =   495
         Left            =   1920
         TabIndex        =   33
         Top             =   6360
         Width           =   1335
         _ExtentX        =   2355
         _ExtentY        =   873
         BackColor       =   16761024
         Caption         =   "清除窗体"
         ButtonPicture   =   "frmB.frx":1454
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         MouseIcon       =   "frmB.frx":1BCE
      End
      Begin VB.Label Label23 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "号"
         BeginProperty Font 
            Name            =   "Microsoft Sans Serif"
            Size            =   11.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   270
         Left            =   5160
         TabIndex        =   31
         Top             =   2115
         Width           =   225
      End
      Begin VB.Label Label22 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "日    期"
         BeginProperty Font 
            Name            =   "黑体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Left            =   2520
         TabIndex        =   9
         Top             =   5880
         Width           =   840
      End
      Begin VB.Label Label21 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "发证机关"
         BeginProperty Font 
            Name            =   "黑体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Left            =   2520
         TabIndex        =   8
         Top             =   5400
         Width           =   840
      End
      Begin VB.Label Label20 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "特发此证"
         BeginProperty Font 
            Name            =   "黑体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Left            =   720
         TabIndex        =   7
         Top             =   4200
         Width           =   840
      End
      Begin VB.Label Label15 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "定,经审定,本建设工程符合城市规划要求,准予建设。"
         BeginProperty Font 
            Name            =   "黑体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Left            =   240
         TabIndex        =   6
         Top             =   3480
         Width           =   5250
      End
      Begin VB.Label Label14 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "根据《中华人民共和国城市规划法》第三十二条规"
         BeginProperty Font 
            Name            =   "黑体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   210
         Left            =   720
         TabIndex        =   5
         Top             =   3000
         Width           =   4620
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "中华人民共和国"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   15.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   315
         Left            =   1680
         TabIndex        =   3
         Top             =   600
         Width           =   2205
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "建设工程规划许可证"
         BeginProperty Font 
            Name            =   "黑体"
            Size            =   18
            Charset         =   134
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   360
         Left            =   1200
         TabIndex        =   2
         Top             =   1320
         Width           =   3375
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "编号"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   11.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   225
         Left            =   1800
         TabIndex        =   1
         Top             =   2160
         Width           =   450
      End
   End
End
Attribute VB_Name = "frmB"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub cmdPrint_Click()
  If MsgBox("确定打印吗?", vbQuestion + vbYesNo, "问题") = vbYes Then
    TextPrint frmB
  End If
End Sub

Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)

End Sub



Private Sub Form_Resize()
  

  Static iLeft1, iLeft2, iTop1, iTop2
  Static ifrmWidth, ifrmHeight

  Debug.Print iLeft1, iLeft2, iTop1, iTop2
  Debug.Print ifrmWidth, ifrmHeight
  If Not (ifrmWidth = 0 Or ifrmHeight = 0) Then
  Picture1.Left = iLeft1 + (Me.Width - ifrmWidth) / 4
  Picture1.Top = iTop1 + (Me.Height - ifrmHeight) / 2
  Picture2.Left = iLeft2 + (Me.Width - ifrmWidth) / 2
  Picture2.Top = iTop2 + (Me.Height - ifrmHeight) / 2
  End If
  iLeft1 = Picture1.Left
  iLeft2 = Picture2.Left
  
  iTop1 = Picture1.Top
  iTop2 = Picture2.Top
  
  ifrmWidth = Me.Width
  ifrmHeight = Me.Height
  'Dim iWidth, ivSpace
  'iWidth = Me.Width - MDIfrmMain.VerticalMenu1.Width
  'ivSpace = (iWidth - Picture1.Width - Picture2.Width) / 4
  'Picture1.Left = (iWidth / 2 - Picture1.Width) / 2 + MDIfrmMain.VerticalMenu1.Width
  'Picture1.Top = (Me.Height - Picture1.Height) / 2
  
  'Debug.Print "Form Width=" & Me.Width, "Picture1 Width=" & Picture1.Width, "Me.Height=" & Me.Height
  'Debug.Print "picture1.height=" & Picture1.Height
  'Debug.Print Me.Left, Me.Top, Picture1.Left, Picture1.Top
  

  'Picture2.Left = MDIfrmMain.VerticalMenu1.Width + Picture1.Width + ivSpace * 3
  'Picture2.Top = (Me.Height - Picture2.Height) / 2
End Sub

Private Sub txtFrmB_DblClick(Index As Integer)
Load frmCoord
  frmCoord.ShowFontSetting "txtFrmB" & Index, Me.Name
  frmCoord.Show 1
End Sub

Private Sub txtFrmA_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
  If Index = 1 And KeyCode = 13 Then
      Call LoadDataB(Trim(txtFrmB(1).Text))
   End If
End Sub
Private Sub LoadDataB(ByVal strKey As String)
   Dim strSQL As String
   Dim rst As ADODB.Recordset
    On Error GoTo errLink
    Set myDB = New ADODB.Connection
      
      myDB.CursorLocation = adUseClient
      myDB.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\zjdb.mdb;Persist Security Info=False"
      myDB.CommandTimeout = 15
      myDB.Open
           
      'Call InitCombol(Me)
      'LockControl Me, False
      Debug.Print myDB

   If strKey = "" Then Exit Sub
   
   Set rst = New ADODB.Recordset
   
   
   strSQL = "select * from 基本情况 where 编号='" & strKey & "'"
   rst.Open strSQL, myDB
   If Not rst.EOF Then
      txtFrmB(0) = "" & rst("编号前缀")
      txtFrmB(2) = "" & Year(rst("日期")) & "年" & Month(rst("日期")) & "月" & Day(rst("日期")) & "日"
      txtFrmB(3) = "" & rst("申请人")
      txtFrmB(4) = "" & rst("项目名称")
      txtFrmB(5) = "" & rst("建设位置")
      txtFrmB(6) = "" & Up(rst("建筑规模")) & "平方米"
   Else
      MsgBox "该项目不存在,请仔细核对!", vbInformation, "提示"
   End If
   rst.Close
   Set rst = Nothing
   Exit Sub
errLink:
    MsgBox err.Description, vbOKOnly + vbExclamation, "提示"
   
End Sub
Private Sub cmdDel_Click()
  Call ClearFrm(Me)
End Sub

Private Sub txtFrmB_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
     If Index = 1 And KeyCode = 13 Then
      Call LoadDataB(Trim(txtFrmB(1).Text))
   End If
End Sub

⌨️ 快捷键说明

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