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;
}
}
}热门推荐
10 同事换单位简短祝福语
11 谢谢朋友的祝福语简短
12 立秋节气简短祝福语
13 新房祝福语简短10字
14 长辈新年祝福语大全简短
15 新年给大家简短祝福语
16 生日祝福语简短独特姑姑
17 芭比的婚礼祝福语简短
18 邀请新人祝福语简短英文