locked
c# Windows form 'Always on top' RRS feed

  • Question

  • I have a checkbox and I want to be able to, if it is checked, make the form stay on top of all other windows all of the time. When it is unchecked, the form can go under the other applications.

    How do I do this?
    Monday, November 30, 2009 4:14 PM

Answers

  • Just set the TopMost property of form on the checkedchanged event of checkbox like

    this.TopMost=checkBox1.Checked;
    • Proposed as answer by Tamer Oz Monday, November 30, 2009 4:39 PM
    • Marked as answer by SkyesOfRock Monday, November 30, 2009 4:50 PM
    Monday, November 30, 2009 4:23 PM

All replies

  • Just set the TopMost property of form on the checkedchanged event of checkbox like

    this.TopMost=checkBox1.Checked;
    • Proposed as answer by Tamer Oz Monday, November 30, 2009 4:39 PM
    • Marked as answer by SkyesOfRock Monday, November 30, 2009 4:50 PM
    Monday, November 30, 2009 4:23 PM
  • If you sold me a program that did that, I would sue to get my money back. 
    Now I cannot open my email, or do anything else if I use your software.  Not good.


    Mark the best replies as answers. "Fooling computers since 1971."
    Monday, November 30, 2009 4:35 PM
    Moderator
  • Well, what I would do is to make it so that you could easily undo the change if you want to
    Monday, November 30, 2009 4:38 PM
  • Thanks for your help guys - the code worked great.
    Monday, November 30, 2009 4:51 PM
  • If you sold me a program that did that, I would sue to get my money back. 
    Now I cannot open my email, or do anything else if I use your software.  Not good.

    You never use the Task Manager ?
    Monday, November 30, 2009 6:01 PM