C#透明窗體實(shí)現(xiàn)方法
更新時間:2015年06月11日 12:27:29 作者:zhuzhao
這篇文章主要介紹了C#透明窗體實(shí)現(xiàn)方法,涉及C#窗體操作的相關(guān)技巧,需要的朋友可以參考下
本文實(shí)例講述了C#透明窗體實(shí)現(xiàn)方法。分享給大家供大家參考。具體實(shí)現(xiàn)方法如下:
namespace WindowsApplication1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
this.Opacity = 1;
this.Text = "opacity=1";
this.TopMost = true;
}
private void Form2_Activated(object sender, EventArgs e)
{
this.timer1.Enabled = true;
}
private void Form2_Deactivate(object sender, EventArgs e)
{
this.timer1.Enabled = false;
this.Opacity = 1;
this.Text = "opacity=" + this.Opacity.ToString();
}
private void Form2_Load(object sender, EventArgs e)
{
}
private void timer1_Tick(object sender, EventArgs e)
{
if (this.Opacity > 0)
{
this.Opacity -= 0.1;
this.Text = "opacity=" + this.Opacity.ToString();
}
else if (this.Opacity == 0)
{
this.Close();
}
else this.timer1.Enabled = false;
}
}
}
希望本文所述對大家的C#程序設(shè)計(jì)有所幫助。
相關(guān)文章
C#基于Linq和反射實(shí)現(xiàn)數(shù)據(jù)持久化框架Xml4DB詳解
在本篇文章里小編給大家整理的是關(guān)于C#基于Linq和反射實(shí)現(xiàn)數(shù)據(jù)持久化框架Xml4DB相關(guān)知識點(diǎn),有需要的朋友們學(xué)習(xí)下。2019-08-08
C#獲取系統(tǒng)當(dāng)前日期和時間的示例詳解
這篇文章主要為大家詳細(xì)介紹了C#如何使用DateTime的Now靜態(tài)屬性動態(tài)獲得系統(tǒng)當(dāng)前日期和時間,文中的示例代碼講解詳細(xì),有需要的小伙伴可以參考一下2024-01-01
C# 中的委托詳細(xì)解析與完整應(yīng)用小結(jié)
C#委托是一種類型安全的函數(shù)指針,允許將方法作為參數(shù)傳遞或賦值給變量,它在事件處理、回調(diào)和異步編程中廣泛應(yīng)用,本文詳細(xì)介紹了委托的基本概念、用法和高級應(yīng)用,感興趣的朋友一起看看吧2025-03-03
C++調(diào)用C#的DLL程序?qū)崿F(xiàn)方法
本文通過例子,講述了C++調(diào)用C#的DLL程序的方法,作出了以下總結(jié),具有一定的參考價值,下面就讓我們一起來學(xué)習(xí)吧2015-10-10
C# Lambda表達(dá)式select()和where()的區(qū)別及用法
這篇文章主要介紹了C# Lambda表達(dá)式select()和where()的區(qū)別及用法,select在linq中一般會用來提取最后篩選的元素集合,在lambda表達(dá)式中通常用where得到元素集合,需要的朋友可以參考下2023-07-07

