Show Application in Taskbar even visible property set to false

Consider a scenario: you have developed an application in which whenever you want to work as background, you set visible property of form to False. But by setting visible property to false, it also disappear from Taskbar.... and now your boss ask to always display in your taskbar... so what should you do?

Either change your code and replace visible property to Windowstate property or some thing else that can utilize your same code? Yes it is.

We can achieve it by VisibleChanged event of form ...

private void Form2_VisibleChanged(object sender, EventArgs e)
        {
             if(this.Visible == false)
            {
                this.Visible = true;
                this.WindowState = FormWindowState.Minimized;
            }
        }

Now whenever form's visible property changed to False, it will minimize it set visible property to true ... so it will also display in taskbar

Comments

Popular posts from this blog

Khuda Karay K Meri Arz -e- Pak Par Utray

Yaar Ko Hamne Ja Baja Dekha (+ lyrics)

میرے بعد بہت سناٹا ہوگا