![]() |
Tipp 0002
|
Programm als Icon im SystemTray anzeigen
|
 |
|
Autor/Einsender: Datum: |
|
Michael Werner 14.01.2003 |
|
Entwicklungsumgebung: |
|
VB.Net 2002 |
Framework: |
|
1.0 |
|
|
In VB 6 musste man die API-Funktion Shell_NotifyIcon aufrufen, und mit einer Struktur und
einer Reihe Konstanten hantieren, um das Programm-Icon im SystemTray (in der Windows-Taskleiste
rechts unten) anzeigen zu lassen. In VB.Net wird es nun ganz einfach mit dem Steuerelement
NotifyIcon, das Eigenschaften wie Visible, Text und Icon besitzt.
|
|
|
Public Class Form1
Inherits System.Windows.Forms.Form Vom Windows Form Designer generierter Code
Private Sub NotifyIcon1_MouseDown( _
ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) _
Handles NotifyIcon1.MouseDown
If (MessageBox.Show("Form wieder anzeigen?", _
"Form anzeigen?", MessageBoxButtons.YesNoCancel, _
MessageBoxIcon.Information)) = DialogResult.Yes Then
Me.Show()
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button2.Click
Me.Hide()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button3.Click
Button2.Enabled = False
NotifyIcon1.Visible = False
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button4.Click
Button2.Enabled = True
NotifyIcon1.Visible = True
End Sub
End Class
|
|
|
|
|
Windows-Version |
98/SE |
 |
|
ME |
 |
|
NT |
 |
|
2000 |
 |
|
XP |
 |
|
Vista |
 |
|
Win
7 |
 |
|
|
|
Download (6,2 kB)
|
Downloads bisher: [ 1687 ]
|
|
|