黃聰: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;
} } }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM