Custom tray panel in VB.NET

413 views Asked by At

i need to create system tray "panel" like Windows Media Player. (not icon only, but complette form with buttons, images, etc.)

Here is wmp screenshot:

wmp

Is it possible in VB.NET & Win 10?

Thanks and sorry for my english.. :)

1

There are 1 answers

2
The Indexer On

You actually can do kind of a "tray panel", and it isn't quite difficult. Just create a Form Object and set its FormBorderStyle property to None, which will allow you to create your custom border. Then, do the following:

Public Class Form1
    Public Timer1 As New Timer
    Private Sub Form1_Load(sender as Object, e as Eventargs) Handles MyBase.Load
        Timer1.Interval = 1
    End Sub

     Private Sub Form1_MouseDown(sender as Object, e as MouseEventargs)
         Timer1.Start()
     End Sub

     Private Sub Form1_MouseUp(sender as Object, e as MouseEventargs)
         Timer1.Stop()
     End Sub

     Private Sub Timer1_Tick(sender as Object, e as Eventargs)
         Me.Location = New Point(Me.Cursor.Position.X - (Me.Cursor.Position.X - Me.Location.X), Me.Cursor.Position.Y - (Me.Cursor.Position.Y - Me.Location.Y))
     End Sub
End Class

Once you've done that (I'm not sure it will work directly, try a bit and it should), enjoy designing the GUI... ;-)
Hope this helps and by the way, your english is better than you think!