右下角提示框
语言:效果:像QQ新闻的提示框(数据来于远程数据库,access)在桌面的右下角,在软件上没有任何点击,当窗体最小化后,鼠标移到图标上就会出现。
<Global.Microsoft.()> _ Partial Class Form1 Inherits System.Windows.Forms.Form 'Form 重写 Dispose,以清理组件列表。 <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub 'Windows 窗体设计器所必需的 Private components As '注意: 以下过程是 Windows 窗体设计器所必需的 '可以使用 Windows 窗体设计器修改它。 '不要使用代码编辑器修改它。 <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() = New resources As = New (GetType(Form1)) Me.NotifyIcon1 = New System.Windows.Forms.NotifyIcon() Me.LinkLabel1 = New System.Windows.Forms.LinkLabel Me.LinkLabel2 = New System.Windows.Forms.LinkLabel Me.SuspendLayout() ' 'NotifyIcon1 ' Me.NotifyIcon1.Icon = CType(resources.GetObject("NotifyIcon1.Icon"), System.Drawing.Icon) Me.NotifyIcon1.Text = "NotifyIcon1" Me.NotifyIcon1.Visible = True ' 'LinkLabel1 ' Me.LinkLabel1.AutoSize = True Me.LinkLabel1.ForeColor = System.Drawing.Color.Lime Me.LinkLabel1.Location = New System.Drawing.Point(8, 61) Me.LinkLabel1.MinimumSize = New System.Drawing.Size(150, 0) Me.LinkLabel1.Name = "LinkLabel1" Me.LinkLabel1.Size = New System.Drawing.Size(150, 12) Me.LinkLabel1.TabIndex = 0 Me.LinkLabel1.TabStop = True Me.LinkLabel1.Text = "https://bbs.bccn.net" ' 'LinkLabel2 ' Me.LinkLabel2.AutoSize = True Me.LinkLabel2.Location = New System.Drawing.Point(8, 105) Me.LinkLabel2.MinimumSize = New System.Drawing.Size(150, 0) Me.LinkLabel2.Name = "LinkLabel2" Me.LinkLabel2.Size = New System.Drawing.Size(150, 12) Me.LinkLabel2.TabIndex = 1 Me.LinkLabel2.TabStop = True Me.LinkLabel2.Text = "退出本程序" ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(185, 166) Me.ControlBox = False Me.Controls.Add(Me.LinkLabel2) Me.Controls.Add(Me.LinkLabel1) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None Me.Name = "Form1" Me.Opacity = 0.5 Me.ShowInTaskbar = False Me.TransparencyKey = System.Drawing.Color.Yellow Me.ResumeLayout(False) Me.PerformLayout() 'Me.SetStyle(ControlStyles.UserPaint, True) End Sub Friend WithEvents NotifyIcon1 As System.Windows.Forms.NotifyIcon Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel Friend WithEvents LinkLabel2 As System.Windows.Forms.LinkLabel End Class
Public Class Form1 Dim x As Double = Me.Width Dim y As Double = Me.Height Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing NotifyIcon1.Dispose() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load x = Me.Width y = Me.Height Me.Width = 0 Me.Height = 0 Me.Visible = False End Sub Private Sub NotifyIcon1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseMove Me.TopMost = True Me.Visible = True Me.WindowState = FormWindowState.Normal Me.SetBounds(System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - x, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - y, x, y) Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None End Sub Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked System.Diagnostics.Process.Start(LinkLabel1.Text) Me.Visible = False End Sub Private Sub LinkLabel2_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked NotifyIcon1.Dispose() End End Sub Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove If e.X = 0 Or e.X = Me.Width Or e.Y = 0 Or e.Y = Me.Height Then Me.Visible = False End Sub Public Sub New() ' 此调用是 Windows 窗体设计器所必需的。 InitializeComponent() ' 在 InitializeComponent() 调用之后添加任何初始化。 End Sub Protected Overrides Sub Finalize() MyBase.Finalize() End Sub End Class
Public Class Form1 Dim x As Double = Me.Width Dim y As Double = Me.Height Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing NotifyIcon1.Dispose() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load x = Me.Width y = Me.Height Me.Width = 0 Me.Height = 0 Me.Visible = False End Sub Private Sub NotifyIcon1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseMove Me.TopMost = True Me.Visible = True Me.WindowState = FormWindowState.Normal Me.SetBounds(System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - x, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - y, x, y) Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None End Sub Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked System.Diagnostics.Process.Start(LinkLabel1.Text) Me.Visible = False End Sub Private Sub LinkLabel2_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked NotifyIcon1.Dispose() End End Sub Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove If e.X = 0 Or e.X = Me.Width Or e.Y = 0 Or e.Y = Me.Height Then Me.Visible = False End Sub End Class
Public Class Form1 Dim x As Double = 200'修改X,Y值即可 Dim y As Double = 120 Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing NotifyIcon1.Dispose() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Width = 0 Me.Height = 0 Me.Visible = False End Sub Private Sub NotifyIcon1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseMove Me.TopMost = True Me.Visible = True Me.WindowState = FormWindowState.Normal Me.SetBounds(System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - x - 30, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - y, x, y) Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Fixed3D End Sub Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked System.Diagnostics.Process.Start(LinkLabel1.Text) Me.Visible = False End Sub Private Sub LinkLabel2_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked NotifyIcon1.Dispose() End End Sub Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove If e.X = 0 Or e.X = Me.Width Or e.Y = 0 Or e.Y = Me.Height Then Me.Visible = False End Sub End Class