简体   繁体   中英

Custom tray panel in VB.NET

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.. :)

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM