Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm writing a transparent WinForms app and I want to hide the app from showing in Task Manager's applications tab. I'm OK with the fact that it will show in Processes (in fact it should). If I set:

this.ShowInTaskbar = false;

it only hides from taskbar.

Full code i have i have a timer made from labels

        public Form1()
    {
        InitializeComponent();
        this.BackColor = Color.LimeGreen;
        this.TransparencyKey = Color.LimeGreen;
        Timer time = new Timer();
        time.Interval = 1000;
        time.Tick += new EventHandler(time_Tick);
        time.Start();
        this.ShowInTaskbar = false;


    }

    void time_Tick(object sender, EventArgs e)
    {
        label1_hour.Text = DateTime.Now.Hour.ToString() ;
        label_minute.Text = DateTime.Now.Minute.ToString();
        label_second.Text = DateTime.Now.Second.ToString();
    }
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
321 views
Welcome To Ask or Share your Answers For Others

1 Answer

Try something like this

public partial class Form1 : Form {
    public Form1() {
        InitializeComponent();
        this.FormBorderStyle = FormBorderStyle.None;
        this.ShowInTaskbar = false;
    }
    protected override CreateParams CreateParams {
        get {
            var cp = base.CreateParams;
            cp.ExStyle |= 0x80;  // Turn on WS_EX_TOOLWINDOW
            return cp;
        }
    }
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...