C#透明窗体实现方法
程序员文章站
2022-06-30 11:15:48
本文实例讲述了c#透明窗体实现方法。分享给大家供大家参考。具体实现方法如下:
namespace windowsapplication1
{
public...
本文实例讲述了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#程序设计有所帮助。