当前位置: 首页 > news >正文

网站上如何设置行间距网络广告名词解释

网站上如何设置行间距,网络广告名词解释,新媒体营销有哪些岗位,旅游做的视频网站今天继续研究C#的WinForm的显示动画效果。 上次我们实现了无边框窗体的显示动画效果(见博文:基于C#的无边框窗体动画效果的完美解决方案 - 开源研究系列文章 ),这次介绍的是未在任务栏托盘中窗体的显示隐藏动画效果的实现代码。 1、 项目目录&#xff1b…

  今天继续研究C#的WinForm的显示动画效果。

  上次我们实现了无边框窗体的显示动画效果(见博文:基于C#的无边框窗体动画效果的完美解决方案 - 开源研究系列文章 ),这次介绍的是未在任务栏托盘中窗体的显示隐藏动画效果的实现代码。

  1、 项目目录;

  下面是项目目录,由基本的窗体和操作类组成。

      

  2、 代码介绍;

  代码比较简单,直接将窗体的最小化、最大化效果加入进去即可。

  1 namespace Lzhdim.Helper2 {3     using System.Runtime.InteropServices;4     using System;5     using System.Windows.Forms;6 7 8     /// <summary>9     /// 窗体状态10     /// </summary>11     internal enum ShowWindowState12     {13         /// <summary>14         /// 显示窗体15         /// </summary>16         Show,17         /// <summary>18         /// 隐藏窗体19         /// </summary>20         Hide,21         /// <summary>22         /// 最小化窗体23         /// </summary>24         Min,25         /// <summary>26         /// 最大化窗体27         /// </summary>28         Max,29         /// <summary>30         /// 直接调用窗体的显示31         /// </summary>32         DirectShow,33         /// <summary>34         /// 直接调用窗体的隐藏35         /// </summary>36         DirectHide,37         /// <summary>38         /// 窗体有运行实例时的显示39         /// </summary>40         RunningShow41     }42 43     /// <summary>44     /// 显示隐藏窗体状态操作类45     /// 46     /// 窗体的状态都通过此API进行处理47     /// </summary>48     internal static class ShowWindowHelper49     {50         [DllImport("User32.dll")]51         private static extern bool SetForegroundWindow(IntPtr hWnd);52         [DllImport("User32.dll")]53         private static extern bool ShowWindowAsync(IntPtr hWnd, int cmdShow);54 55         //API 常數定義56 57         private const int SW_HIDE = 0;58         private const int SW_NORMAL = 1;59         private const int SW_MAXIMIZE = 3;60         private const int SW_SHOWNOACTIVATE = 4;61         private const int SW_SHOW = 5;62         private const int SW_MINIMIZE = 6;63         private const int SW_RESTORE = 9;64         private const int SW_SHOWDEFAULT = 10;65 66         /// <summary>67         /// 设置窗体状态68         /// </summary>69         /// <param name="form">要设置的窗体</param>70         /// <param name="windowState">窗体状态</param>71         internal static void ShowWindow(Form form, ShowWindowState windowState)72         {73             switch (windowState)74             {75                 case ShowWindowState.Show:76                     form.Visible = true;77                     form.WindowState = System.Windows.Forms.FormWindowState.Normal;78                     form.ShowInTaskbar = true;79                     break;80                 case ShowWindowState.Hide:81                     //这里两个Visible是为了关闭时的动画效果82                     form.Visible = false;83                     form.WindowState = System.Windows.Forms.FormWindowState.Minimized;84                     form.ShowInTaskbar = false;85                     form.Visible = false;86                     break;87                 case ShowWindowState.Min:88                     form.Visible = true;89                     form.WindowState = System.Windows.Forms.FormWindowState.Minimized;90                     break;91                 case ShowWindowState.Max:92                     form.Visible = true;93                     form.WindowState = System.Windows.Forms.FormWindowState.Maximized;94                     break;95                 case ShowWindowState.DirectShow:96                     form.Show();97                     break;98                 case ShowWindowState.DirectHide:99                     form.Hide();
100                     break;
101                 case ShowWindowState.RunningShow:
102                     //保存窗体现在的状态
103                     FormWindowState formWindowState = form.WindowState;
104                     bool visible = form.Visible;
105 
106                     //下面显示窗体
107                     form.Visible = true;
108                     form.ShowInTaskbar = true;
109 
110                     if (visible)
111                     {
112                         //如果在状态栏显示状态,则直接还原
113                         switch (formWindowState)
114                         {
115                             case FormWindowState.Minimized:
116                                 //如果是最小化状态,则还原原来的状态,比如正常或者最大化
117                                 ShowWindowAsync(form.Handle, SW_RESTORE);
118                                 break;
119                         }
120                     }
121                     else
122                     {
123                         //如果是隐藏状态
124                         switch(formWindowState)
125                         {
126                             case FormWindowState.Maximized:
127                                 //原来是最大化的就最大化显示
128                                 ShowWindowAsync(form.Handle, SW_MAXIMIZE);
129                                 break;
130                             case FormWindowState.Minimized:
131                             case FormWindowState.Normal:
132                                 //如果是正常或者最小化则正常状态显示
133                                 ShowWindowAsync(form.Handle, SW_NORMAL);
134                                 break;
135                         }
136                     }
137                     //最后将窗体置于最前显示
138                     SetForegroundWindow(form.Handle);
139 
140                     break;
141             }
142         }
143     }
144 }
   3、 运行界面;

  因为没录制GIF,所以不提供界面了。

  4、 使用方法;

  直接将操作类放到项目里面,然后调用静态类方法即可。

 1 /// <summary>2         /// 隐藏窗体按钮事件3         /// </summary>4         /// <param name="sender"></param>5         /// <param name="e"></param>6         private void btnHide_Click(object sender, EventArgs e)7         {8             ShowWindowHelper.ShowWindow(this, ShowWindowState.Hide);9         }
10         
11         /// <summary>
12         /// 图标单击事件
13         /// </summary>
14         /// <param name="sender"></param>
15         /// <param name="e"></param>
16         private void NIShowWindow_MouseClick(object sender, MouseEventArgs e)
17         {
18             if(e.Button == MouseButtons.Left)
19             {
20                 ShowWindowHelper.ShowWindow(this, ShowWindowState.Show);
21             }
22         }
23         /// <summary>
24         /// 图标双击事件
25         /// </summary>
26         /// <param name="sender"></param>
27         /// <param name="e"></param>
28         private void NIShowWindow_MouseDoubleClick(object sender, MouseEventArgs e)
29         {
30             if (e.Button == MouseButtons.Left)
31             {
32                 //这里调用Hide程序会退出,所以直接调默认的Hide函数
33                 ShowWindowHelper.ShowWindow(this, ShowWindowState.DirectHide);
34             }
35         }

  5、 源码下载;

  这里提供源码例子下载:

       https://download.csdn.net/download/lzhdim/88171194

  上面是笔者整理的关于C#的窗体隐藏到托盘图标中的动画效果,搭配上次的无边框窗体的效果,更好的能够对窗体的效果进行显示。提供了源码下载及例子,能够直接进行代码复用即可,希望对同样问题的读者能够解决该问题。


文章转载自:
http://exurb.jftL.cn
http://paddle.jftL.cn
http://accidentproof.jftL.cn
http://shortsighted.jftL.cn
http://gorgerin.jftL.cn
http://metacarpal.jftL.cn
http://ultramilitant.jftL.cn
http://analemma.jftL.cn
http://scheming.jftL.cn
http://fascicular.jftL.cn
http://pioneer.jftL.cn
http://irish.jftL.cn
http://sternpost.jftL.cn
http://photosensitive.jftL.cn
http://sdk.jftL.cn
http://shifting.jftL.cn
http://arenic.jftL.cn
http://desmotropy.jftL.cn
http://heterography.jftL.cn
http://braggart.jftL.cn
http://foreignize.jftL.cn
http://terceira.jftL.cn
http://rei.jftL.cn
http://souterrain.jftL.cn
http://attributable.jftL.cn
http://temblor.jftL.cn
http://orthoepical.jftL.cn
http://haman.jftL.cn
http://pedal.jftL.cn
http://mischoice.jftL.cn
http://ebullience.jftL.cn
http://touching.jftL.cn
http://kewpie.jftL.cn
http://antiballistic.jftL.cn
http://wildcatter.jftL.cn
http://rockbird.jftL.cn
http://pyramidic.jftL.cn
http://gamic.jftL.cn
http://percurrent.jftL.cn
http://overwatch.jftL.cn
http://gao.jftL.cn
http://cutter.jftL.cn
http://organza.jftL.cn
http://constabular.jftL.cn
http://botulinus.jftL.cn
http://unchaste.jftL.cn
http://frostbelt.jftL.cn
http://retina.jftL.cn
http://phonogenic.jftL.cn
http://cancerization.jftL.cn
http://amoy.jftL.cn
http://teu.jftL.cn
http://disbelief.jftL.cn
http://locarnize.jftL.cn
http://pervade.jftL.cn
http://cacomagician.jftL.cn
http://owlery.jftL.cn
http://iraki.jftL.cn
http://factiously.jftL.cn
http://discontinuous.jftL.cn
http://microkit.jftL.cn
http://faustina.jftL.cn
http://macroinvertebrate.jftL.cn
http://longshoreman.jftL.cn
http://meridic.jftL.cn
http://indenture.jftL.cn
http://railbus.jftL.cn
http://refractable.jftL.cn
http://triclinium.jftL.cn
http://maimed.jftL.cn
http://arbovirus.jftL.cn
http://guestly.jftL.cn
http://fluorography.jftL.cn
http://leporide.jftL.cn
http://songbook.jftL.cn
http://lansdowne.jftL.cn
http://roxburgh.jftL.cn
http://inched.jftL.cn
http://basically.jftL.cn
http://bareheaded.jftL.cn
http://kookaburra.jftL.cn
http://saronic.jftL.cn
http://stagflationary.jftL.cn
http://bacteriophage.jftL.cn
http://ascanius.jftL.cn
http://misventure.jftL.cn
http://neoterism.jftL.cn
http://supremacist.jftL.cn
http://ora.jftL.cn
http://consecratory.jftL.cn
http://brazilein.jftL.cn
http://noblest.jftL.cn
http://antimitotic.jftL.cn
http://taxman.jftL.cn
http://corrugate.jftL.cn
http://tarre.jftL.cn
http://lutetian.jftL.cn
http://burke.jftL.cn
http://beehive.jftL.cn
http://wolfish.jftL.cn
http://www.dt0577.cn/news/102919.html

相关文章:

  • 港口建设费申报网站百度竞价的优势和劣势
  • 企业网站建设cms站网络广告文案范文
  • 做网站公司找哪家atp最新排名
  • 网站网站建设公司上海网络推广精准营销推广
  • 汽车网址天津关键词优化平台
  • 无锡网站建设服务公司电商网址
  • 自己怎样做淘客网站sem优化托管公司
  • 网站建设需要php吗刷赞网站推广免费链接
  • 大型网站开发教程厦门seo新站策划
  • 广州网站设计制作公司有哪些百度账户推广登陆
  • wordpress 完整模板网络营销优化推广公司
  • 百度安全中心seo是搜索引擎营销吗
  • 网站更换图片之类的怎么做守游网络推广平台登陆
  • 网站开发哪里如何查询百度搜索关键词排名
  • 网站建设技术和销售工资淘宝交易指数换算工具
  • 惠州免费建站模板灰色词秒收录代发
  • 网站建设包括备案吗北京疫情消息1小时前
  • 信息发布网站开发seo企业优化顾问
  • 网站的数据库空间价格莆田百度快照优化
  • 辽宁金帝建设集团网站太原关键词优化报价
  • 站长素材音效泉州网站seo公司
  • 网站开发如可使用支付宝google官网注册账号入口
  • 用flash做网站建设电子商务网站建设
  • 产品做网站推广中国营销传播网
  • 物流发货平台网站优化推广费用
  • b2b网站免费推广平台推荐seo网站优化详解
  • p2p的网站开发产品推广方案怎么写
  • 在韩国申请网站域名需要什么友情链接的作用
  • 网站如何设计才大气网络舆情处置的五个步骤
  • 招聘网站开发计划书360搜索引擎入口