frmsendemail.vb

来自「<Visual Basic 数据库开发实例精粹(第二版)>一书首先介」· VB 代码 · 共 614 行 · 第 1/2 页

VB
614
字号


Public Class frmSendEmail
  Inherits System.Windows.Forms.Form

  '帐号SMTP信息
  Class AccountInfo
    Public Account As String
    Public Pwd As String
    Public SMTPServer As String
  End Class

  Dim m_AccountInfo As New AccountInfo
  Dim m_frmPmtObj As New frmPrompt

#Region " Windows 窗体设计器生成的代码 "

  Public Sub New()
    MyBase.New()

    '该调用是 Windows 窗体设计器所必需的。
    InitializeComponent()

    '在 InitializeComponent() 调用之后添加任何初始化

  End Sub

  '窗体重写 dispose 以清理组件列表。
  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

  '注意: 以下过程是 Windows 窗体设计器所必需的
  '可以使用 Windows 窗体设计器修改此过程。
  '不要使用代码编辑器修改它。
  Public WithEvents MainMenu1 As System.Windows.Forms.MainMenu
  Public WithEvents mnuOperate As System.Windows.Forms.MenuItem
  Public WithEvents mnuSendInfo As System.Windows.Forms.MenuItem
  Public WithEvents ln1 As System.Windows.Forms.MenuItem
  Public WithEvents mnuReturn As System.Windows.Forms.MenuItem
  Public WithEvents mnuHelp As System.Windows.Forms.MenuItem
  Public WithEvents mnuHelpInfo As System.Windows.Forms.MenuItem
  Public WithEvents pic As System.Windows.Forms.Panel
  Public WithEvents labTitle As System.Windows.Forms.Label
  Public WithEvents labTitle2 As System.Windows.Forms.Label
  Public WithEvents grpInput As System.Windows.Forms.GroupBox
  Friend WithEvents rtxtContent As System.Windows.Forms.RichTextBox
  Public WithEvents cmdSend As System.Windows.Forms.Button
  Public WithEvents cmdCancel As System.Windows.Forms.Button
  Public WithEvents labSendDept As System.Windows.Forms.Label
  Public WithEvents grpDeptList As System.Windows.Forms.GroupBox
  Public WithEvents labReceiveList As System.Windows.Forms.Label
  Friend WithEvents ColorDialog1 As System.Windows.Forms.ColorDialog
  Friend WithEvents panInput As System.Windows.Forms.Panel
  Public WithEvents labEMailTitle As System.Windows.Forms.Label
  Friend WithEvents tcboClientType As UtilityLibrary.Combos.TreeCombo
  Friend WithEvents chkShowInGroup As System.Windows.Forms.CheckBox
  Friend WithEvents btnBrowse As System.Windows.Forms.Button
  Friend WithEvents tlvClient As System.Windows.Forms.TreeListView
  Friend WithEvents ImgListListViewS As System.Windows.Forms.ImageList
  Friend WithEvents ImgListTreeView As System.Windows.Forms.ImageList
  Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader
  Public WithEvents txtSenderEmail As System.Windows.Forms.TextBox
  Public WithEvents txtTitle As System.Windows.Forms.TextBox
  <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.components = New System.ComponentModel.Container
    Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmSendEmail))
    Me.MainMenu1 = New System.Windows.Forms.MainMenu
    Me.mnuOperate = New System.Windows.Forms.MenuItem
    Me.mnuSendInfo = New System.Windows.Forms.MenuItem
    Me.ln1 = New System.Windows.Forms.MenuItem
    Me.mnuReturn = New System.Windows.Forms.MenuItem
    Me.mnuHelp = New System.Windows.Forms.MenuItem
    Me.mnuHelpInfo = New System.Windows.Forms.MenuItem
    Me.pic = New System.Windows.Forms.Panel
    Me.labTitle = New System.Windows.Forms.Label
    Me.labTitle2 = New System.Windows.Forms.Label
    Me.grpInput = New System.Windows.Forms.GroupBox
    Me.btnBrowse = New System.Windows.Forms.Button
    Me.panInput = New System.Windows.Forms.Panel
    Me.rtxtContent = New System.Windows.Forms.RichTextBox
    Me.txtSenderEmail = New System.Windows.Forms.TextBox
    Me.txtTitle = New System.Windows.Forms.TextBox
    Me.cmdSend = New System.Windows.Forms.Button
    Me.cmdCancel = New System.Windows.Forms.Button
    Me.labSendDept = New System.Windows.Forms.Label
    Me.labEMailTitle = New System.Windows.Forms.Label
    Me.grpDeptList = New System.Windows.Forms.GroupBox
    Me.tlvClient = New System.Windows.Forms.TreeListView
    Me.ColumnHeader1 = New System.Windows.Forms.ColumnHeader
    Me.ImgListListViewS = New System.Windows.Forms.ImageList(Me.components)
    Me.chkShowInGroup = New System.Windows.Forms.CheckBox
    Me.tcboClientType = New UtilityLibrary.Combos.TreeCombo
    Me.ImgListTreeView = New System.Windows.Forms.ImageList(Me.components)
    Me.labReceiveList = New System.Windows.Forms.Label
    Me.ColorDialog1 = New System.Windows.Forms.ColorDialog
    Me.pic.SuspendLayout()
    Me.grpInput.SuspendLayout()
    Me.panInput.SuspendLayout()
    Me.grpDeptList.SuspendLayout()
    Me.SuspendLayout()
    '
    'MainMenu1
    '
    Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuOperate, Me.mnuHelp})
    '
    'mnuOperate
    '
    Me.mnuOperate.Index = 0
    Me.mnuOperate.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuSendInfo, Me.ln1, Me.mnuReturn})
    Me.mnuOperate.Text = "操作(&O)"
    '
    'mnuSendInfo
    '
    Me.mnuSendInfo.Index = 0
    Me.mnuSendInfo.Shortcut = System.Windows.Forms.Shortcut.CtrlS
    Me.mnuSendInfo.Text = "立即发送(&S)"
    '
    'ln1
    '
    Me.ln1.Index = 1
    Me.ln1.Text = "-"
    '
    'mnuReturn
    '
    Me.mnuReturn.Index = 2
    Me.mnuReturn.Shortcut = System.Windows.Forms.Shortcut.CtrlR
    Me.mnuReturn.Text = "返回(&R)"
    '
    'mnuHelp
    '
    Me.mnuHelp.Index = 1
    Me.mnuHelp.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.mnuHelpInfo})
    Me.mnuHelp.Text = "帮助(&H)"
    '
    'mnuHelpInfo
    '
    Me.mnuHelpInfo.Index = 0
    Me.mnuHelpInfo.Shortcut = System.Windows.Forms.Shortcut.CtrlH
    Me.mnuHelpInfo.Text = "帮助文档(&H)"
    '
    'pic
    '
    Me.pic.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
                Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
    Me.pic.BackColor = System.Drawing.Color.FromArgb(CType(99, Byte), CType(117, Byte), CType(222, Byte))
    Me.pic.Controls.Add(Me.labTitle)
    Me.pic.Controls.Add(Me.labTitle2)
    Me.pic.Cursor = System.Windows.Forms.Cursors.Default
    Me.pic.ForeColor = System.Drawing.SystemColors.WindowText
    Me.pic.Location = New System.Drawing.Point(2, 4)
    Me.pic.Name = "pic"
    Me.pic.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.pic.Size = New System.Drawing.Size(716, 24)
    Me.pic.TabIndex = 25
    Me.pic.TabStop = True
    '
    'labTitle
    '
    Me.labTitle.AutoSize = True
    Me.labTitle.BackColor = System.Drawing.Color.Transparent
    Me.labTitle.Cursor = System.Windows.Forms.Cursors.Default
    Me.labTitle.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
    Me.labTitle.ForeColor = System.Drawing.Color.White
    Me.labTitle.Location = New System.Drawing.Point(10, 4)
    Me.labTitle.Name = "labTitle"
    Me.labTitle.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.labTitle.Size = New System.Drawing.Size(63, 19)
    Me.labTitle.TabIndex = 24
    Me.labTitle.Text = "发送邮件"
    '
    'labTitle2
    '
    Me.labTitle2.AutoSize = True
    Me.labTitle2.BackColor = System.Drawing.Color.Transparent
    Me.labTitle2.Cursor = System.Windows.Forms.Cursors.Default
    Me.labTitle2.Font = New System.Drawing.Font("宋体", 10.5!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
    Me.labTitle2.ForeColor = System.Drawing.SystemColors.ControlText
    Me.labTitle2.Location = New System.Drawing.Point(12, 6)
    Me.labTitle2.Name = "labTitle2"
    Me.labTitle2.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.labTitle2.Size = New System.Drawing.Size(49, 19)
    Me.labTitle2.TabIndex = 23
    Me.labTitle2.Text = "新信息"
    '
    'grpInput
    '
    Me.grpInput.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                Or System.Windows.Forms.AnchorStyles.Left) _
                Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
    Me.grpInput.BackColor = System.Drawing.SystemColors.Control
    Me.grpInput.Controls.Add(Me.btnBrowse)
    Me.grpInput.Controls.Add(Me.panInput)
    Me.grpInput.Controls.Add(Me.txtSenderEmail)
    Me.grpInput.Controls.Add(Me.txtTitle)
    Me.grpInput.Controls.Add(Me.cmdSend)
    Me.grpInput.Controls.Add(Me.cmdCancel)
    Me.grpInput.Controls.Add(Me.labSendDept)
    Me.grpInput.Controls.Add(Me.labEMailTitle)
    Me.grpInput.ForeColor = System.Drawing.SystemColors.ControlText
    Me.grpInput.Location = New System.Drawing.Point(2, 28)
    Me.grpInput.Name = "grpInput"
    Me.grpInput.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.grpInput.Size = New System.Drawing.Size(522, 406)
    Me.grpInput.TabIndex = 24
    Me.grpInput.TabStop = False
    '
    'btnBrowse
    '
    Me.btnBrowse.FlatStyle = System.Windows.Forms.FlatStyle.Popup
    Me.btnBrowse.Location = New System.Drawing.Point(471, 17)
    Me.btnBrowse.Name = "btnBrowse"
    Me.btnBrowse.Size = New System.Drawing.Size(34, 20)
    Me.btnBrowse.TabIndex = 25
    Me.btnBrowse.Text = "..."
    '
    'panInput
    '
    Me.panInput.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                Or System.Windows.Forms.AnchorStyles.Left) _
                Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
    Me.panInput.Controls.Add(Me.rtxtContent)
    Me.panInput.Location = New System.Drawing.Point(17, 75)
    Me.panInput.Name = "panInput"
    Me.panInput.Size = New System.Drawing.Size(485, 275)
    Me.panInput.TabIndex = 24
    '
    'rtxtContent
    '
    Me.rtxtContent.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                Or System.Windows.Forms.AnchorStyles.Left) _
                Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
    Me.rtxtContent.AutoWordSelection = True
    Me.rtxtContent.HideSelection = False
    Me.rtxtContent.Location = New System.Drawing.Point(0, 1)
    Me.rtxtContent.Name = "rtxtContent"
    Me.rtxtContent.Size = New System.Drawing.Size(485, 274)
    Me.rtxtContent.TabIndex = 23
    Me.rtxtContent.Text = ""
    '
    'txtSenderEmail
    '
    Me.txtSenderEmail.AutoSize = False
    Me.txtSenderEmail.BackColor = System.Drawing.SystemColors.Window
    Me.txtSenderEmail.Cursor = System.Windows.Forms.Cursors.IBeam
    Me.txtSenderEmail.ForeColor = System.Drawing.SystemColors.WindowText
    Me.txtSenderEmail.Location = New System.Drawing.Point(98, 17)
    Me.txtSenderEmail.MaxLength = 30
    Me.txtSenderEmail.Name = "txtSenderEmail"
    Me.txtSenderEmail.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.txtSenderEmail.Size = New System.Drawing.Size(360, 20)
    Me.txtSenderEmail.TabIndex = 0
    Me.txtSenderEmail.Text = ""
    '
    'txtTitle
    '
    Me.txtTitle.AcceptsReturn = True
    Me.txtTitle.AutoSize = False
    Me.txtTitle.BackColor = System.Drawing.SystemColors.Window
    Me.txtTitle.Cursor = System.Windows.Forms.Cursors.IBeam
    Me.txtTitle.ForeColor = System.Drawing.SystemColors.WindowText
    Me.txtTitle.Location = New System.Drawing.Point(98, 45)
    Me.txtTitle.MaxLength = 50
    Me.txtTitle.Name = "txtTitle"
    Me.txtTitle.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.txtTitle.Size = New System.Drawing.Size(405, 19)
    Me.txtTitle.TabIndex = 4
    Me.txtTitle.Text = ""
    '
    'cmdSend
    '
    Me.cmdSend.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
    Me.cmdSend.BackColor = System.Drawing.SystemColors.Control
    Me.cmdSend.Cursor = System.Windows.Forms.Cursors.Default
    Me.cmdSend.ForeColor = System.Drawing.SystemColors.ControlText
    Me.cmdSend.Location = New System.Drawing.Point(250, 361)
    Me.cmdSend.Name = "cmdSend"
    Me.cmdSend.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.cmdSend.Size = New System.Drawing.Size(104, 27)
    Me.cmdSend.TabIndex = 8
    Me.cmdSend.Text = "立即发送(&S)"
    '
    'cmdCancel
    '
    Me.cmdCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
    Me.cmdCancel.BackColor = System.Drawing.SystemColors.Control
    Me.cmdCancel.Cursor = System.Windows.Forms.Cursors.Default
    Me.cmdCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
    Me.cmdCancel.ForeColor = System.Drawing.SystemColors.ControlText
    Me.cmdCancel.Location = New System.Drawing.Point(370, 361)
    Me.cmdCancel.Name = "cmdCancel"
    Me.cmdCancel.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.cmdCancel.Size = New System.Drawing.Size(104, 27)
    Me.cmdCancel.TabIndex = 9
    Me.cmdCancel.Text = "取消(&C)"
    '
    'labSendDept
    '
    Me.labSendDept.AutoSize = True

⌨️ 快捷键说明

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