Carbongrip
Carbongrip

Reputation: 173

Prevent window from showing in alt tab

I am working on a program where I don't want a window to show in alt tab menu. However I need the window style to be borderless. All the solutions I have found say to change the border to tool but that won't work when I need the window to be borderless. Anyone have ideas?

Upvotes: 1

Views: 3974

Answers (2)

Carbongrip
Carbongrip

Reputation: 173

I followed the link, had to scroll down. The answer is to use this code on the forms class:

protected override CreateParams CreateParams
{
    get
    {
        CreateParams cp = base.CreateParams;
        // turn on WS_EX_TOOLWINDOW style bit
        cp.ExStyle |= 0x80;
        return cp;
    }
}

Also see this link for more info.

Upvotes: 3

Bhavin
Bhavin

Reputation: 260

this.ShowInTaskbar = false;

yourform.ShowInTaskbar = false;// In Properties Window or write this in form load event

You must also set the FormBorderStyle

this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;

Upvotes: 0

Related Questions