本文实例讲述了c#透明窗体实现方法。分享给大家供大家参考。具体实现方法如下:
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#程序设计有所帮助。
如对本文有疑问, 点击进行留言回复!!
使用Visual Studio2019创建C#项目(窗体应用程序、控制台应用程序、Web应用程序)
C#实现获取本地内网(局域网)和外网(公网)IP地址的方法分析
网友评论