Net-informations.com
SiteMap  | About    

Keep Form on Top of All Other Windows

The System.Windows.Forms namespace contains classes for creating Windows-based applications that take full advantage of the rich user interface features available in the Microsoft Windows operating system. You can bring a Form on top of application by simply setting the Form.topmost form property to true will force the form to the top layer of the screen, while leaving the user able to enter data in the forms below.

  Form2 frm = new Form2();
  frm.TopMost = true;
  frm.Show();

Topmost forms are always displayed at the highest point in the z-order of the windows on the desktop. You can use this property to create a form that is always displayed in your application, such as a MessageBox window.




using System;
using System.Windows.Forms;

namespace WindowsFormsApplication1
{
	public partial class Form1 : Form
	{
		public Form1()
		{
			InitializeComponent();
		}

		private void button1_Click(object sender, EventArgs e)
		{
			Form2 frm = new Form2();
			frm.TopMost = true;
			frm.Show();
		}
	}
}






net-informations.com (C) 2017    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.