har lavet et lille eksempel på tray og form move.. håber det kan bruges
Public Class Form1
Dim myTray As New NotifyIcon
Dim trayMenu As New ContextMenuStrip
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
trayMenu.Items.Add("Restore", Nothing, AddressOf ShowHide)
trayMenu.Items.Add("Exit", Nothing, AddressOf Quit)
myTray.Icon = New Icon("ikon.ico")
myTray.Text = "MyAppTitle"
myTray.ContextMenuStrip = trayMenu
Dim w As Integer = Screen.PrimaryScreen.WorkingArea.Width - Me.Width - 10
Dim h As Integer = Screen.PrimaryScreen.WorkingArea.Height - Me.Height - 10
Me.Location = New Point(w, h)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ShowHide()
End Sub
Public Sub ShowHide()
If Me.Visible = False Then
Me.Visible = True
myTray.Visible = False
Else
Me.Visible = False
myTray.Visible = True
End If
End Sub
Public Sub Quit()
'save??
Application.Exit()
End Sub
End Class
opret en form med en knap (Button1), og husk at have en ikon fil med navnet ikon.ico i samme mappe some din exe-fil (dvs: xxxx\bin\Debug\ikon.ico)
Indlæg senest redigeret d. 01.01.2009 21:46 af Bruger #3427