本文以實例描述了C#實現讓窗體永遠在窗體最前面顯示的方法,具體步驟如下:
1、新建一個窗體程序,添加一個Timer以及設置它可用并綁定事件。
2、設置窗體的TopMost屬性為True
3、然后設置代碼如下即可實現.
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace jiyi{ public partial class Form1 : Form {public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void timer1_Tick(object sender, EventArgs e) { this.TopMost = false; this.BringToFront(); this.TopMost = true; } }}
|
新聞熱點
疑難解答