C#实现让窗体永远在窗体最前面显示的实例
本文以实例描述了C#实现让窗体永远在窗体最前面显示的方法,具体步骤如下:
1、新建一个窗体程序,添加一个Timer以及设置它可用并绑定事件。
2、设置窗体的TopMost属性为True
3、然后设置代码如下即可实现.
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Text;
usingSystem.Windows.Forms;namespacejiyi
{
publicpartialclassForm1:Form
{publicForm1()
{
InitializeComponent();
}
privatevoidForm1_Load(objectsender,EventArgse)
{
}
privatevoidtimer1_Tick(objectsender,EventArgse)
{
this.TopMost=false;
this.BringToFront();
this.TopMost=true;
}
}
}