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

📄 frmreport.vb

📁 Visual Basic管理信息系统开发 学生考试系统(源代码)
💻 VB
字号:
Option Strict Off
Option Explicit On
Friend Class frmReport
	Inherits System.Windows.Forms.Form
#Region "Windows 窗体设计器生成的代码"
	Public Sub New()
		MyBase.New()
		If m_vb6FormDefInstance Is Nothing Then
			If m_InitializingDefInstance Then
				m_vb6FormDefInstance = Me
			Else
				Try 
					'对于启动窗体,所创建的第一个实例为默认实例。
					If System.Reflection.Assembly.GetExecutingAssembly.EntryPoint.DeclaringType Is Me.GetType Then
						m_vb6FormDefInstance = Me
					End If
				Catch
				End Try
			End If
		End If
		'此调用是 Windows 窗体设计器所必需的。
		InitializeComponent()
	End Sub
	'窗体重写处置,以清理组件列表。
	Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
		If Disposing Then
			If Not components Is Nothing Then
				components.Dispose()
			End If
		End If
		MyBase.Dispose(Disposing)
	End Sub
	'Windows 窗体设计器所必需的
	Private components As System.ComponentModel.IContainer
	Public ToolTip1 As System.Windows.Forms.ToolTip
	Public WithEvents CmdExit As System.Windows.Forms.Button
	Public WithEvents CmdPrint As System.Windows.Forms.Button
	Public WithEvents txtFile As System.Windows.Forms.TextBox
	Public WithEvents FrameMain As System.Windows.Forms.GroupBox
	'注意: 以下过程是 Windows 窗体设计器所必需的
	'可以使用 Windows 窗体设计器来修改它。
	'不要使用代码编辑器修改它。
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
		Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmReport))
		Me.components = New System.ComponentModel.Container()
		Me.ToolTip1 = New System.Windows.Forms.ToolTip(components)
		Me.ToolTip1.Active = True
		Me.FrameMain = New System.Windows.Forms.GroupBox
		Me.CmdExit = New System.Windows.Forms.Button
		Me.CmdPrint = New System.Windows.Forms.Button
		Me.txtFile = New System.Windows.Forms.TextBox
		Me.BackColor = System.Drawing.Color.FromARGB(192, 192, 255)
		Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
		Me.Text = "Form1"
		Me.ClientSize = New System.Drawing.Size(456, 431)
		Me.Location = New System.Drawing.Point(0, 0)
		Me.ShowInTaskbar = False
		Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
		Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
		Me.ControlBox = True
		Me.Enabled = True
		Me.KeyPreview = False
		Me.MaximizeBox = True
		Me.MinimizeBox = True
		Me.Cursor = System.Windows.Forms.Cursors.Default
		Me.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.HelpButton = False
		Me.WindowState = System.Windows.Forms.FormWindowState.Normal
		Me.Name = "frmReport"
		Me.FrameMain.Size = New System.Drawing.Size(441, 417)
		Me.FrameMain.Location = New System.Drawing.Point(8, 8)
		Me.FrameMain.TabIndex = 0
		Me.FrameMain.BackColor = System.Drawing.SystemColors.Control
		Me.FrameMain.Enabled = True
		Me.FrameMain.ForeColor = System.Drawing.SystemColors.ControlText
		Me.FrameMain.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.FrameMain.Visible = True
		Me.FrameMain.Name = "FrameMain"
		Me.CmdExit.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
		Me.CmdExit.Text = "退出"
		Me.CmdExit.Size = New System.Drawing.Size(49, 25)
		Me.CmdExit.Location = New System.Drawing.Point(376, 384)
		Me.CmdExit.TabIndex = 3
		Me.CmdExit.BackColor = System.Drawing.SystemColors.Control
		Me.CmdExit.CausesValidation = True
		Me.CmdExit.Enabled = True
		Me.CmdExit.ForeColor = System.Drawing.SystemColors.ControlText
		Me.CmdExit.Cursor = System.Windows.Forms.Cursors.Default
		Me.CmdExit.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.CmdExit.TabStop = True
		Me.CmdExit.Name = "CmdExit"
		Me.CmdPrint.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
		Me.CmdPrint.Text = "打印"
		Me.CmdPrint.Size = New System.Drawing.Size(57, 25)
		Me.CmdPrint.Location = New System.Drawing.Point(312, 384)
		Me.CmdPrint.TabIndex = 2
		Me.CmdPrint.BackColor = System.Drawing.SystemColors.Control
		Me.CmdPrint.CausesValidation = True
		Me.CmdPrint.Enabled = True
		Me.CmdPrint.ForeColor = System.Drawing.SystemColors.ControlText
		Me.CmdPrint.Cursor = System.Windows.Forms.Cursors.Default
		Me.CmdPrint.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.CmdPrint.TabStop = True
		Me.CmdPrint.Name = "CmdPrint"
		Me.txtFile.AutoSize = False
		Me.txtFile.Font = New System.Drawing.Font("隶书", 15!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
		Me.txtFile.Size = New System.Drawing.Size(425, 361)
		Me.txtFile.Location = New System.Drawing.Point(8, 16)
		Me.txtFile.ReadOnly = True
		Me.txtFile.MultiLine = True
		Me.txtFile.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
		Me.txtFile.TabIndex = 1
		Me.txtFile.AcceptsReturn = True
		Me.txtFile.TextAlign = System.Windows.Forms.HorizontalAlignment.Left
		Me.txtFile.BackColor = System.Drawing.SystemColors.Window
		Me.txtFile.CausesValidation = True
		Me.txtFile.Enabled = True
		Me.txtFile.ForeColor = System.Drawing.SystemColors.WindowText
		Me.txtFile.HideSelection = True
		Me.txtFile.Maxlength = 0
		Me.txtFile.Cursor = System.Windows.Forms.Cursors.IBeam
		Me.txtFile.RightToLeft = System.Windows.Forms.RightToLeft.No
		Me.txtFile.TabStop = True
		Me.txtFile.Visible = True
		Me.txtFile.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
		Me.txtFile.Name = "txtFile"
		Me.Controls.Add(FrameMain)
		Me.FrameMain.Controls.Add(CmdExit)
		Me.FrameMain.Controls.Add(CmdPrint)
		Me.FrameMain.Controls.Add(txtFile)
	End Sub
#End Region 
#Region "升级支持"
	Private Shared m_vb6FormDefInstance As frmReport
	Private Shared m_InitializingDefInstance As Boolean
	Public Shared Property DefInstance() As frmReport
		Get
			If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
				m_InitializingDefInstance = True
				m_vb6FormDefInstance = New frmReport()
				m_InitializingDefInstance = False
			End If
			DefInstance = m_vb6FormDefInstance
		End Get
		Set
			m_vb6FormDefInstance = Value
		End Set
	End Property
#End Region 
	Private varFileName As String '定义私有变量存放文件名
	WriteOnly Property FileName() As String
		Set(ByVal Value As String) '定义属性FileName
			varFileName = Value
			'UPGRADE_WARNING: Dir 有新行为。 单击以获得更多信息:“ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1041"”
			Dim strFile As String
			If Dir(Value, FileAttribute.Normal) <> "" Then '如果文件存在,则读取文件内容并显示到文本框中
				strFile = ""
				On Error Resume Next
				FileOpen(1, Value, OpenMode.Input)
				While Not EOF(1)
					strFile = LineInput(1)
					Me.txtFile.Text = Me.txtFile.Text & strFile & vbCrLf
				End While
				FileClose(1)
			End If
		End Set
	End Property
	
	Private Sub CmdExit_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CmdExit.Click
		Me.Close() '从窗体中退出
	End Sub
	
	Private Sub CmdPrint_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles CmdPrint.Click
		'UPGRADE_ISSUE: Printer 属性 Printer.Font 未升级。 单击以获得更多信息:“ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup2069"”
		Printer.Font = VB6.FontChangeName(Printer.Font, Me.txtFile.Font.Name) '设置打印字体
		'UPGRADE_ISSUE: Printer 对象 未升级。 单击以获得更多信息:“ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup2068"”
		'UPGRADE_ISSUE: Printer 方法 Printer.Print 未升级。 单击以获得更多信息:“ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup2069"”
		Printer.Print(Me.txtFile.Text) '设置打印内容
		'UPGRADE_ISSUE: Printer 方法 Printer.EndDoc 未升级。 单击以获得更多信息:“ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup2069"”
		Printer.EndDoc() '开始打印
	End Sub
End Class

⌨️ 快捷键说明

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