Csharp/C#教程:C#透明窗体实现方法分享

本文实例讲述了C#透明窗体实现方法。分享给大家供大家参考。具体实现方法如下:

namespaceWindowsApplication1 { publicpartialclassForm2:Form { publicForm2() { InitializeComponent(); this.Opacity=1; this.Text="opacity=1"; this.TopMost=true; } privatevoidForm2_Activated(objectsender,EventArgse) { this.timer1.Enabled=true; } privatevoidForm2_Deactivate(objectsender,EventArgse) { this.timer1.Enabled=false; this.Opacity=1; this.Text="opacity="+this.Opacity.ToString(); } privatevoidForm2_Load(objectsender,EventArgse) { } privatevoidtimer1_Tick(objectsender,EventArgse) { if(this.Opacity>0) { this.Opacity-=0.1; this.Text="opacity="+this.Opacity.ToString(); } elseif(this.Opacity==0) { this.Close(); } elsethis.timer1.Enabled=false; } } }

希望本文所述对大家的C#程序设计有所帮助。

您可能感兴趣的文章:c#给button添加不规则的图片以及用pictureBox替代button响应点击事件的方法c#图片处理之图片裁剪成不规则图形c#窗体传值用法实例详解C#实现由四周向中心缩小的窗体退出特效C#实现更改MDI窗体背景颜色的方法C#实现在Form里面内嵌dos窗体的方法C#圆角窗体简单实现方法C#创建不规则窗体的4种方式详解

标签: 窗体 方法

C++中string与int的相互转换实现代码

C#实现系统托盘通知的方法

上述就是C#学习教程:C#透明窗体实现方法分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/cdevelopment/906536.html

(0)
上一篇 2021年10月23日
下一篇 2021年10月23日

精彩推荐