回复 10楼 不说也罢
那访问数据库的代码要怎么写??不好意思。我是新手……很我都不懂的
建议你找本入门的书先研究一下,不要急于写程序,好吗?
从你问的问题看不应当是刚入门的,应当有一定基础的哦
程序代码:Public Class Form1
Dim x As Double = 200
Dim y As Double = 120
Dim i As Integer
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
If Me.Visible = True And Me.Top = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - y Then Exit Sub
Me.TopMost = True
Me.Visible = True
Me.WindowState = FormWindowState.Normal
Do While i < y
i = i + 1
Me.SetBounds(System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - x - 30, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - i, x, y)
Loop
i = 0
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 - 10 Or e.Y = 0 Or e.Y >= Me.Height - 5 Then Me.Visible = False
End Sub
End Class

程序代码:Public Class Form1
'此窗体只需要一个NotifyIcon1控件
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
Form2.Show()
End Sub
End Class
程序代码:Public Class Form2
' 此窗体需要一个Label1控件,一个LinkLabel1控件
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim r As New Random
Dim i As Integer = r.Next
Me.Visible = False
Me.ShowInTaskbar = False
Me.SetBounds(System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - 250, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - 200, 200, 200)
Me.Visible = True
Me.TopMost = True
Label1.Text = i '这是随机数,FORM2每次加载都不一样,这里就可以读取数据库了
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 - 10 Or e.Y = 0 Or e.Y >= Me.Height - 5 Then Me.Close()
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'修改一下,不然不会随机显示,改为下面一行
Me.Close()
End Sub
End Class

程序代码:Public Class Form1
'此窗体只需要一个NotifyIcon1控件
Public isShow As Boolean = False
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
If isShow = True Then Exit Sub
Form2.Show()
End Sub
End Class
程序代码:Public Class Form2
' 此窗体需要一个Label1控件,一个LinkLabel1控件
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Form1.isShow = True
Dim r As New Random
Dim i As Integer = r.Next
Me.Visible = False
Me.ShowInTaskbar = False
Me.SetBounds(System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width - 250, System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - 200, 200, 200)
Me.Visible = True
Me.TopMost = True
Label1.Text = i '这是随机数,FORM2每次加载都不一样,这里就可以读取数据库了
End Sub
Private Sub Form2_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
Form1.isShow = False
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 - 10 Or e.Y = 0 Or e.Y >= Me.Height - 5 Then Me.Close()
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.Close()
End Sub
Private Sub LinkLabel2_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked
Me.Close()
End Sub
End Class
