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

📄 frmmain.vb

📁 <Visual Basic 数据库开发实例精粹(第二版)>一书首先介绍了Visual Basic(简称VB)开发的技巧和重点技术
💻 VB
📖 第 1 页 / 共 4 页
字号:
    Me.rdiDeptReceive.Size = New System.Drawing.Size(196, 18)
    Me.rdiDeptReceive.TabIndex = 66
    Me.rdiDeptReceive.TabStop = True
    Me.rdiDeptReceive.Text = "哪个部门发给我的信息?"
    '
    'cboDept
    '
    Me.cboDept.BackColor = System.Drawing.SystemColors.Window
    Me.cboDept.Cursor = System.Windows.Forms.Cursors.Default
    Me.cboDept.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
    Me.cboDept.ForeColor = System.Drawing.SystemColors.WindowText
    Me.cboDept.Location = New System.Drawing.Point(5, 106)
    Me.cboDept.Name = "cboDept"
    Me.cboDept.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.cboDept.Size = New System.Drawing.Size(209, 20)
    Me.cboDept.TabIndex = 62
    '
    'chkAddresser
    '
    Me.chkAddresser.BackColor = System.Drawing.Color.Transparent
    Me.chkAddresser.Cursor = System.Windows.Forms.Cursors.Default
    Me.chkAddresser.ForeColor = System.Drawing.SystemColors.ControlText
    Me.chkAddresser.Location = New System.Drawing.Point(6, 130)
    Me.chkAddresser.Name = "chkAddresser"
    Me.chkAddresser.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.chkAddresser.Size = New System.Drawing.Size(181, 21)
    Me.chkAddresser.TabIndex = 63
    Me.chkAddresser.Text = "发件人:"
    '
    'txtAddresser
    '
    Me.txtAddresser.AutoSize = False
    Me.txtAddresser.BackColor = System.Drawing.SystemColors.Window
    Me.txtAddresser.Cursor = System.Windows.Forms.Cursors.IBeam
    Me.txtAddresser.Enabled = False
    Me.txtAddresser.ForeColor = System.Drawing.SystemColors.WindowText
    Me.txtAddresser.Location = New System.Drawing.Point(5, 154)
    Me.txtAddresser.MaxLength = 0
    Me.txtAddresser.Name = "txtAddresser"
    Me.txtAddresser.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.txtAddresser.Size = New System.Drawing.Size(200, 19)
    Me.txtAddresser.TabIndex = 64
    Me.txtAddresser.Text = ""
    '
    'Label4
    '
    Me.Label4.AutoSize = True
    Me.Label4.BackColor = System.Drawing.Color.Transparent
    Me.Label4.Cursor = System.Windows.Forms.Cursors.Default
    Me.Label4.ForeColor = System.Drawing.SystemColors.ControlText
    Me.Label4.Location = New System.Drawing.Point(4, 40)
    Me.Label4.Name = "Label4"
    Me.Label4.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.Label4.Size = New System.Drawing.Size(103, 17)
    Me.Label4.TabIndex = 65
    Me.Label4.Text = "请选择查询条件:"
    '
    'labResult
    '
    Me.labResult.AutoSize = True
    Me.labResult.BackColor = System.Drawing.Color.Transparent
    Me.labResult.Cursor = System.Windows.Forms.Cursors.Default
    Me.labResult.ForeColor = System.Drawing.SystemColors.ControlText
    Me.labResult.Location = New System.Drawing.Point(31, 351)
    Me.labResult.Name = "labResult"
    Me.labResult.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.labResult.Size = New System.Drawing.Size(171, 17)
    Me.labResult.TabIndex = 65
    Me.labResult.Text = "本次查询为您找到 0 条记录。"
    Me.labResult.Visible = False
    '
    'labResult1
    '
    Me.labResult1.AutoSize = True
    Me.labResult1.BackColor = System.Drawing.Color.Transparent
    Me.labResult1.Cursor = System.Windows.Forms.Cursors.Default
    Me.labResult1.ForeColor = System.Drawing.SystemColors.ControlText
    Me.labResult1.Location = New System.Drawing.Point(31, 327)
    Me.labResult1.Name = "labResult1"
    Me.labResult1.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.labResult1.Size = New System.Drawing.Size(91, 17)
    Me.labResult1.TabIndex = 66
    Me.labResult1.Text = "本次查询完毕。"
    Me.labResult1.Visible = False
    '
    'cmdSearch
    '
    Me.cmdSearch.BackColor = System.Drawing.Color.White
    Me.cmdSearch.Cursor = System.Windows.Forms.Cursors.Default
    Me.cmdSearch.ForeColor = System.Drawing.SystemColors.ControlText
    Me.cmdSearch.Location = New System.Drawing.Point(23, 376)
    Me.cmdSearch.Name = "cmdSearch"
    Me.cmdSearch.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.cmdSearch.TabIndex = 63
    Me.cmdSearch.Text = "查询(&Q)"
    '
    'cmdBack
    '
    Me.cmdBack.BackColor = System.Drawing.Color.White
    Me.cmdBack.Cursor = System.Windows.Forms.Cursors.Default
    Me.cmdBack.DialogResult = System.Windows.Forms.DialogResult.Cancel
    Me.cmdBack.ForeColor = System.Drawing.SystemColors.ControlText
    Me.cmdBack.Location = New System.Drawing.Point(103, 376)
    Me.cmdBack.Name = "cmdBack"
    Me.cmdBack.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.cmdBack.Size = New System.Drawing.Size(76, 23)
    Me.cmdBack.TabIndex = 64
    Me.cmdBack.Text = "返回(&R)"
    '
    'XPanderAdvSearch
    '
    Me.XPanderAdvSearch.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
                Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
    Me.XPanderAdvSearch.Animated = True
    Me.XPanderAdvSearch.AnimationTime = 30
    Me.XPanderAdvSearch.BackColor = System.Drawing.Color.Transparent
    Me.XPanderAdvSearch.BorderStyle = System.Windows.Forms.Border3DStyle.Flat
    Me.XPanderAdvSearch.CaptionFont = New System.Drawing.Font("Microsoft Sans Serif", 8.0!, System.Drawing.FontStyle.Bold)
    Me.XPanderAdvSearch.CaptionFormatFlag = XPanderControl.XPander.FormatFlag.NoWrap
    Me.XPanderAdvSearch.CaptionStyle = XPanderControl.XPander.CaptionStyleEnum.Normal
    Me.XPanderAdvSearch.CaptionText = "高级查询"
    Me.XPanderAdvSearch.CaptionTextAlign = XPanderControl.XPander.CaptionTextAlignment.Left
    Me.XPanderAdvSearch.ChevronStyle = XPanderControl.XPander.ChevronStyleEnum.Image
    Me.XPanderAdvSearch.CollapsedHighlightImage = CType(resources.GetObject("XPanderAdvSearch.CollapsedHighlightImage"), System.Drawing.Bitmap)
    Me.XPanderAdvSearch.CollapsedImage = CType(resources.GetObject("XPanderAdvSearch.CollapsedImage"), System.Drawing.Bitmap)
    Me.XPanderAdvSearch.Controls.Add(Me.chkExcludeReply)
    Me.XPanderAdvSearch.Controls.Add(Me.chkContent)
    Me.XPanderAdvSearch.Controls.Add(Me.txtKeys)
    Me.XPanderAdvSearch.DockPadding.Top = 25
    Me.XPanderAdvSearch.ExpandedHighlightImage = CType(resources.GetObject("XPanderAdvSearch.ExpandedHighlightImage"), System.Drawing.Bitmap)
    Me.XPanderAdvSearch.ExpandedImage = CType(resources.GetObject("XPanderAdvSearch.ExpandedImage"), System.Drawing.Bitmap)
    Me.XPanderAdvSearch.Location = New System.Drawing.Point(0, 199)
    Me.XPanderAdvSearch.Name = "XPanderAdvSearch"
    Me.XPanderAdvSearch.Size = New System.Drawing.Size(217, 112)
    Me.XPanderAdvSearch.TabIndex = 1
    Me.XPanderAdvSearch.Tag = 1
    Me.XPanderAdvSearch.TooltipText = Nothing
    '
    'chkExcludeReply
    '
    Me.chkExcludeReply.Location = New System.Drawing.Point(7, 87)
    Me.chkExcludeReply.Name = "chkExcludeReply"
    Me.chkExcludeReply.Size = New System.Drawing.Size(174, 20)
    Me.chkExcludeReply.TabIndex = 67
    Me.chkExcludeReply.Text = "不包括回复的信息"
    '
    'chkContent
    '
    Me.chkContent.BackColor = System.Drawing.Color.Transparent
    Me.chkContent.Cursor = System.Windows.Forms.Cursors.Default
    Me.chkContent.ForeColor = System.Drawing.SystemColors.ControlText
    Me.chkContent.Location = New System.Drawing.Point(5, 37)
    Me.chkContent.Name = "chkContent"
    Me.chkContent.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.chkContent.Size = New System.Drawing.Size(181, 21)
    Me.chkContent.TabIndex = 65
    Me.chkContent.Text = "信件内容:"
    '
    'txtKeys
    '
    Me.txtKeys.AcceptsReturn = True
    Me.txtKeys.AutoSize = False
    Me.txtKeys.BackColor = System.Drawing.SystemColors.Window
    Me.txtKeys.Cursor = System.Windows.Forms.Cursors.IBeam
    Me.txtKeys.Enabled = False
    Me.txtKeys.ForeColor = System.Drawing.SystemColors.WindowText
    Me.txtKeys.Location = New System.Drawing.Point(5, 58)
    Me.txtKeys.MaxLength = 0
    Me.txtKeys.Name = "txtKeys"
    Me.txtKeys.RightToLeft = System.Windows.Forms.RightToLeft.No
    Me.txtKeys.Size = New System.Drawing.Size(200, 19)
    Me.txtKeys.TabIndex = 66
    Me.txtKeys.Text = ""
    '
    'tmrSearch
    '
    Me.tmrSearch.Interval = 10
    '
    'frmMain
    '
    Me.AcceptButton = Me.cmdSearch
    Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
    Me.CancelButton = Me.cmdBack
    Me.ClientSize = New System.Drawing.Size(776, 542)
    Me.Controls.Add(Me.rtxtContent)
    Me.Controls.Add(Me.palLoginInfo)
    Me.Controls.Add(Me.splitMsgUp)
    Me.Controls.Add(Me.tlvMsgTitle)
    Me.Controls.Add(Me.splitLeft)
    Me.Controls.Add(Me.trvDept)
    Me.Controls.Add(Me.StatusBar1)
    Me.Controls.Add(Me.xplSearch)
    Me.Controls.Add(Me.palPrevTitle)
    Me.Controls.Add(Me.tbMain)
    Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
    Me.Menu = Me.MainMenu1
    Me.MinimumSize = New System.Drawing.Size(600, 500)
    Me.Name = "frmMain"
    Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
    Me.Text = "企业办公联系系统V2.0"
    Me.palLoginInfo.ResumeLayout(False)
    CType(Me.stbInfo, System.ComponentModel.ISupportInitialize).EndInit()
    CType(Me.stbLogo, System.ComponentModel.ISupportInitialize).EndInit()
    CType(Me.stdCapsLock, System.ComponentModel.ISupportInitialize).EndInit()
    CType(Me.stbPanalNum, System.ComponentModel.ISupportInitialize).EndInit()
    Me.palPrevTitle.ResumeLayout(False)
    Me.xplSearch.ResumeLayout(False)
    Me.XPanderBaseSearch.ResumeLayout(False)
    Me.XPanderAdvSearch.ResumeLayout(False)
    Me.ResumeLayout(False)

  End Sub

#End Region


#Region "窗体控件更新代码"

  '初始化窗体上的控件内容
  Private Sub InitForm()
    '初始化部门树
    mdlCtrl.InitDeptTreeView(trvDept)

    '初始化信件列表
    InitMsgListView(tlvMsgTitle, MessageType.MsgTypeReceive, ViewType.vtList)
    UpdateMsgListView(tlvMsgTitle, MessageType.MsgTypeReceive, 0, LoginedUserInfo.m_iRoleID, True)

    '欢迎信息
    labLoginedDept.Text = LoginedUserInfo.m_szRoleName & " - " & LoginedUserInfo.m_szTrueName

    '初始化查询窗体
    mdlCtrl.AddDeptsToCombo(cboDept, False, True)
    XPanderAdvSearch.Collapse()

  End Sub

  '根据当前TreeView的选项自动更新消息列表(ListView)内容
  '当TreeView选种项发生变代时,需要调用此函数
  Private Sub AutoUpdateMsgList()
    Dim iDeptSend, iDeptReceive As Integer
    Dim curMsgType As MessageType
    Dim selNode As TreeNode = trvDept.SelectedNode
    If selNode Is Nothing Then
      Exit Sub
    End If

    '1) 获取选中的节点位于Inbox组还是Outbox组
    Dim itemType As TreeItemType
    If selNode.Tag > 0 Then
      '如果是部门节点,则找出它是属于Inbox还是Outbox
      itemType = selNode.Parent.Tag
    Else
      itemType = selNode.Tag
    End If

    '2) 根据itemType来确定iDeptSend和iDeptReceive
    If itemType = TreeItemType.Inbox Then
      iDeptSend = selNode.Tag
      iDeptReceive = LoginedUserInfo.m_iRoleID
      curMsgType = MessageType.MsgTypeReceive
    ElseIf itemType = TreeItemType.Outbox Then
      iDeptSend = LoginedUserInfo.m_iRoleID
      iDeptReceive = selNode.Tag
      curMsgType = MessageType.MsgTypeSend
    ElseIf itemType = TreeItemType.Root Then
      '此时不做处理
      Exit Sub
    End If

    '更新控件
    mdlCtrl.InitMsgListView(tlvMsgTitle, curMsgType, ViewType.vtList)
    mdlCtrl.UpdateMsgListView(tlvMsgTitle, curMsgType, iDeptSend, iDeptReceive, True)

  End Sub

  '更新当前选种信息的预览内容
  '当ListView选种项发生变化时,需要调用此函数
  Private Sub UpdateMsgPreview()
    Dim iMsgId As Long
    Dim dmMsg As New InfoProSysBusiness.MessageDataModel
    Dim ErrMsg As String
    If tlvMsgTitle.SelectedItems.Count < 1 Then
      labPrevTitle.Text = "信件内容:"
      rtxtContent.Text = ""
      Exit Sub
    End If

    '设置预览title
    iMsgId = tlvMsgTitle.SelectedItems(0).Tag
    Dim MsgObj As New InfoProSysBusiness.Message
    ErrMsg = MsgObj.ReceiveMsg(iMsgId, dmMsg)
    If ErrMsg <> "" Then
      labPrevTitle.Text = "信件内容:"
    Else
      If tlvMsgTitle.Tag = MessageType.MsgTypeReceive Then
        labPrevTitle.Text = "来自 " & dmMsg.m_szDeptSendName & " 发送于 " & dmMsg.m_dtSendTime & " 的信件"
      Else
        labPrevTitle.Text = "发送到 " & dmMsg.m_szDeptReceiveName & " 发送于 " & dmMsg.m_dtSendTime & " 的信件"
      End If
    End If

    '设置内容,首先偿试用rtf格式显示
    Try
      rtxtContent.Rtf = dmMsg.m_szInfoContent
    Catch ex As Exception
      rtxtContent.Text = dmMsg.m_szInfoContent
    End Try
  End Sub

  '更新控件的显示状态,
  '当TreeView或ListView控件状态/内容发生变代时,需要调用此函数
  Private Sub UpdateCmdUI()
    If tlvMsgTitle.SelectedItems.Count = 0 Then
      mnuDelete.Enabled = False
      tbnDelete.Enabled = False
      mnuReply.Enabled = False
      tbnReply.Enabled = False
    Else
      mnuDelete.Enabled = True
      tbnDelete.Enabled = True
      mnuReply.Enabled = True
      tbnReply.Enabled = True
    End If
  End Sub

#End Region

#Region "实际的功能函数"

  '显示关于信息
  Private Sub DoShowAbout(ByVal bShow As Boolean)
    tlvMsgTitle.Visible = Not bShow
    splitMsgUp.Visible = Not bShow
    palPrevTitle.Visible = Not bShow

⌨️ 快捷键说明

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