Search code examples
.netvb.netvisual-studiotitlebarcustom-titlebar

How to add a "minimize to systray" button in the TitleBar?


How I can add a "minimize to systray" near the "minimize" button in the form's TitleBar?

Is easy or hard for a beginner? I need to do it with the WinAPI?

I can't find any info or full example about this.

PS: I'm using VB.NET on Win7


Solution

  • On the nView menu there is something like this, or else you could set the formborderstyle to none, add a button, and add this code:

    Dim i As New NotifyIcon With {Set properties here}
    Me.Hide()
    

    Then add an event to the notify icon to make the form show.

    EDIT: I just found this link: Adding Custom title bar buttons.