Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I display an Icon on the Taskbar but not on the form itself?

If I use ShowIcon in the form properties, I get the icon in the top left of my form (I don't want that), but I do get my icon in the taskbar.

If I turn ShowIcon off, then I get no icon on the form but I get the default winform icon on the taskbar.

I've tried changing border style, but FixedToolWindow creates an undesirable look that doesn't match the style of the other forms.

like image 690
jgritten Avatar asked Sep 28 '22 14:09

jgritten


1 Answers

I have found a workaround. If you do Me.ShowIcon = False after the form is loaded, then it will display in the taskbar, but not on the program.

One way to do this is to have a timer enabled/begin as soon as form load ends, and then on tick, do Me.ShowIcon = False

As Below:

Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
    Me.ShowIcon = False
    Timer1.Enabled = False
End Sub

Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
     Timer1.enabled = True
End Sub

Timer1 has an interval of 100ms (which works). If you just put the ShowIcon as True in the Form1_Load, a weird Icon shows (not the program's original icon). This is why we use the Timer.

like image 169
Sastreen Avatar answered Oct 20 '22 00:10

Sastreen