📄 frmshowwarn.vb
字号:
Friend Class frmShowWarn
Inherits System.Windows.Forms.Form
#Region "Windows 窗体设计器生成的代码"
Public Sub New()
MyBase.New()
'此调用是 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 chkLoadTipsAtStartup As System.Windows.Forms.CheckBox
Public WithEvents cmdNextTip As System.Windows.Forms.Button
Public WithEvents labPage As System.Windows.Forms.Label
Public WithEvents lblTipText As System.Windows.Forms.Label
Public WithEvents Picture1 As System.Windows.Forms.Panel
Public WithEvents cmdOK As System.Windows.Forms.Button
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器来修改它。
'不要使用代码编辑器修改它。
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmShowWarn))
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
Me.chkLoadTipsAtStartup = New System.Windows.Forms.CheckBox
Me.cmdNextTip = New System.Windows.Forms.Button
Me.Picture1 = New System.Windows.Forms.Panel
Me.PictureBox1 = New System.Windows.Forms.PictureBox
Me.labPage = New System.Windows.Forms.Label
Me.lblTipText = New System.Windows.Forms.Label
Me.cmdOK = New System.Windows.Forms.Button
Me.Picture1.SuspendLayout()
Me.SuspendLayout()
'
'chkLoadTipsAtStartup
'
Me.chkLoadTipsAtStartup.BackColor = System.Drawing.SystemColors.Control
Me.chkLoadTipsAtStartup.Cursor = System.Windows.Forms.Cursors.Default
Me.chkLoadTipsAtStartup.ForeColor = System.Drawing.SystemColors.ControlText
Me.chkLoadTipsAtStartup.Location = New System.Drawing.Point(10, 211)
Me.chkLoadTipsAtStartup.Name = "chkLoadTipsAtStartup"
Me.chkLoadTipsAtStartup.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.chkLoadTipsAtStartup.Size = New System.Drawing.Size(164, 23)
Me.chkLoadTipsAtStartup.TabIndex = 3
Me.chkLoadTipsAtStartup.Text = "在启动时显示提示(&S)"
'
'cmdNextTip
'
Me.cmdNextTip.BackColor = System.Drawing.SystemColors.Control
Me.cmdNextTip.Cursor = System.Windows.Forms.Cursors.Default
Me.cmdNextTip.ForeColor = System.Drawing.SystemColors.ControlText
Me.cmdNextTip.Location = New System.Drawing.Point(326, 43)
Me.cmdNextTip.Name = "cmdNextTip"
Me.cmdNextTip.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.cmdNextTip.Size = New System.Drawing.Size(117, 27)
Me.cmdNextTip.TabIndex = 2
Me.cmdNextTip.Text = "下一条提示(&N)"
'
'Picture1
'
Me.Picture1.BackColor = System.Drawing.Color.White
Me.Picture1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.Picture1.Controls.Add(Me.PictureBox1)
Me.Picture1.Controls.Add(Me.labPage)
Me.Picture1.Controls.Add(Me.lblTipText)
Me.Picture1.Cursor = System.Windows.Forms.Cursors.Default
Me.Picture1.ForeColor = System.Drawing.SystemColors.ControlText
Me.Picture1.Location = New System.Drawing.Point(10, 9)
Me.Picture1.Name = "Picture1"
Me.Picture1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.Picture1.Size = New System.Drawing.Size(298, 195)
Me.Picture1.TabIndex = 1
Me.Picture1.TabStop = True
'
'PictureBox1
'
Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)
Me.PictureBox1.Location = New System.Drawing.Point(8, 8)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(32, 32)
Me.PictureBox1.TabIndex = 6
Me.PictureBox1.TabStop = False
'
'labPage
'
Me.labPage.BackColor = System.Drawing.Color.White
Me.labPage.Cursor = System.Windows.Forms.Cursors.Default
Me.labPage.ForeColor = System.Drawing.SystemColors.ControlText
Me.labPage.Location = New System.Drawing.Point(48, 17)
Me.labPage.Name = "labPage"
Me.labPage.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.labPage.Size = New System.Drawing.Size(213, 18)
Me.labPage.TabIndex = 5
Me.labPage.Text = "今日提醒..."
'
'lblTipText
'
Me.lblTipText.BackColor = System.Drawing.Color.White
Me.lblTipText.Cursor = System.Windows.Forms.Cursors.Default
Me.lblTipText.ForeColor = System.Drawing.SystemColors.ControlText
Me.lblTipText.Location = New System.Drawing.Point(14, 60)
Me.lblTipText.Name = "lblTipText"
Me.lblTipText.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.lblTipText.Size = New System.Drawing.Size(261, 118)
Me.lblTipText.TabIndex = 4
Me.lblTipText.Text = "没有今日提醒……"
'
'cmdOK
'
Me.cmdOK.BackColor = System.Drawing.SystemColors.Control
Me.cmdOK.Cursor = System.Windows.Forms.Cursors.Default
Me.cmdOK.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.cmdOK.ForeColor = System.Drawing.SystemColors.ControlText
Me.cmdOK.Location = New System.Drawing.Point(326, 9)
Me.cmdOK.Name = "cmdOK"
Me.cmdOK.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.cmdOK.Size = New System.Drawing.Size(117, 27)
Me.cmdOK.TabIndex = 0
Me.cmdOK.Text = "确定"
'
'frmShowWarn
'
Me.AcceptButton = Me.cmdOK
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.BackColor = System.Drawing.SystemColors.Control
Me.CancelButton = Me.cmdOK
Me.ClientSize = New System.Drawing.Size(454, 235)
Me.Controls.Add(Me.chkLoadTipsAtStartup)
Me.Controls.Add(Me.cmdNextTip)
Me.Controls.Add(Me.Picture1)
Me.Controls.Add(Me.cmdOK)
Me.Cursor = System.Windows.Forms.Cursors.Default
Me.HelpButton = True
Me.Location = New System.Drawing.Point(307, 265)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "frmShowWarn"
Me.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
Me.Text = "今日提醒"
Me.Picture1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Dim m_WarningAry As New ArrayList '内存中的提示数据库
Dim m_iCurrentTip As Integer '当前正在显示的提示集合的索引
Private Sub DoNextWarn()
'按顺序遍历提示
m_iCurrentTip = m_iCurrentTip + 1
If m_WarningAry.Count <= m_iCurrentTip Then
m_iCurrentTip = 0
End If
' 显示它。
Me.DisplayCurrentTip()
End Sub
Private Sub chkLoadTipsAtStartup_CheckStateChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles chkLoadTipsAtStartup.CheckStateChanged
' 保存在下次启动时是否显示此窗体
SaveSetting(Application.ProductName, "Options", "在启动时显示提示", CStr(chkLoadTipsAtStartup.CheckState))
End Sub
Private Sub cmdNextTip_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdNextTip.Click
DoNextWarn()
End Sub
Private Sub cmdOK_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles cmdOK.Click
Me.Close()
End Sub
Public Sub ShowWarn(ByVal ParentObj As Object, _
ByVal boolCanHide As Boolean, _
ByVal bHideIfNoWarn As Boolean)
Dim WarnObj As New clientMgrBusiness.Warning
Dim dmWarn As New clientMgrBusiness.WarningDataModel
Dim ErrMsg As String
Dim ShowAtStartup As Integer
' 察看在启动时是否将被显示
ShowAtStartup = CInt(GetSetting(Application.ProductName, "Options", "在启动时显示提示", CStr(1)))
'标识是否可以隐藏此对话框
If boolCanHide Then
If ShowAtStartup = 0 Then
Exit Sub
End If
End If
Me.chkLoadTipsAtStartup.CheckState = ShowAtStartup
ErrMsg = WarnObj.SearchWarningsByDate(m_WarningAry, Today, True)
If m_WarningAry.Count = 0 Then
'dmWarn.Msg = "没有今日提醒……"
'm_WarningAry.Add(dmWarn)
If bHideIfNoWarn Then
Exit Sub
End If
End If
m_iCurrentTip = 0
Call DisplayCurrentTip()
Me.ShowDialog()
End Sub
Public Sub DisplayCurrentTip()
If m_WarningAry.Count > 0 Then
labPage.Text = "今日提醒... 第" & m_iCurrentTip + 1 & "条/共" & m_WarningAry.Count & "条"
lblTipText.Text = m_WarningAry(m_iCurrentTip).Msg
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -