using System; 

using System.Collections.Generic; 

using System.ComponentModel; 

using System.Data; 

using System.Drawing; 

using System.Text; 

using System.Windows.Forms; 

namespace WindowsApplication1 

{ 

    public partial class Form2 : Form 

    { 

        public Form2() 

        { 

            InitializeComponent(); 

        } 

        private void Form2_SizeChanged(object sender, EventArgs e) 

        { 

            if (this.WindowState == FormWindowState.Minimized) 

            { 

                this.ShowInTaskbar = false; 

                this.notifyIcon1.Visible = true; 

            } 

        } 

        private void Form2_Load(object sender, EventArgs e) 

        { 

            this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); 

            notifyIcon1.Icon = new Icon("my.ico"); 

            notifyIcon1.Visible = false; 

            notifyIcon1.Click += new System.EventHandler(this.notifyIcon1_Click); 

            this.SizeChanged += new System.EventHandler(this.Form2_SizeChanged); 

        } 

        private void notifyIcon1_Click(object sender, EventArgs e) 

        { 

            if (this.WindowState == FormWindowState.Minimized) 

            { 

                this.WindowState = FormWindowState.Normal; 

                this.Activate(); 

                this.notifyIcon1.Visible = false; 

                this.ShowInTaskbar = true; 

            } 

        } 

  

    } 

}

备注:ico图标文件需放在bin\debug文件夹下;form界面需要添加notifyIcon1控件

C# winform 最小化到电脑右下角的更多相关文章

  1. Winform 最小化双击显示,最小化右键退出。退出

    WinForm 之 窗口最小化到托盘及右键图标显示菜单 Form最小化是指整个Form都缩小到任务栏上,但是窗体以Form的标题栏形式显示在任务栏上, 若是想让Form以Icon的形式显示在任务栏右下 ...

  2. winform最小化及添加右键

    private void PrintService_SizeChanged(object sender, EventArgs e) { if (this.WindowState == FormWind ...

  3. WinForm最小化到托盘以及托盘右键菜单

    首先,先拖一个NotifyIcon到主窗体,然后设置NotifyIcon的图标,不然等下最小化后,都找不到那个程序了,还有那个Text也是,不写名字,就默认是NotifyIcon了..如下图: 然后双 ...

  4. C#- Winform最小化到托盘

    实现前先拉一个notifyIcon控件,在Icon属性中加入一个ICON小图标,然后具体的代码实现如下: using System; using System.Collections.Generic; ...

  5. winform最小化到托盘

    1.拖取NotifyIcon控件.将该控件的visible设成false. 2.指定NotifyIcon的Icon(很重要,否则最小化后找不到窗口). 3.找到window的SizeChanged事件 ...

  6. [WinForm]最小化到系统托盘,右键退出

    1.拉出一个notifyIcon1到用户界面,也可以NEW一个 2.拉出一个ContextMenuStrip控件,命名为mymenu,集合中增加退出 3.notifyIcon1的属性ContextMe ...

  7. winform最小化后重复进load事件原因

    最近编写一个工具发现的问题,窗体不论是最小化还是进入托盘,重新打开的时候都会进入控件load事件. 产生这个现象的条件是: 1.使用了用户控件,在控件中使用了load事件 2.在主窗体中,隐藏或显示任 ...

  8. winform最小化后隐藏到右下角,单击或双击后恢复 .

    01.//先拖一个notifyIcon控件进来 02. 03.//然后在您的notifyIcon控件中添加 MouseDoubleClick事件,代码如下 04. 05. private void n ...

  9. winform最小化及关闭提示

    public PrintService() { InitializeComponent(); this.WindowState = FormWindowState.Minimized; } priva ...

随机推荐

  1. 图表框架HelloCharts(3)饼状图

    1 效果图 2 xml文件 activity_pie_chart.xml <FrameLayout xmlns:android="http://schemas.android.com/ ...

  2. $http POST 转字符串

  3. Make AngularJS $http service behave like jQuery.ajax()(转)

    There is much confusion among newcomers to AngularJS as to why the $http service shorthand functions ...

  4. Svn正确的使用方法

    想必大家现在都比较喜欢使用svn(subversion)完成代码管理了,因为它的开源,轻巧,易用.但是这样一个宝贝如果不知道其正确的用法,也会让我们百思不得其解,甚至耽误项目进度,浪费程序员的心血和结 ...

  5. 快速搭建建SSH服务

    一般来说如果用Ubuntu作为服务器,我们经常需要通过其他客户端远程连接它. 远程连接需要使用SSH,这里列出了一个快速完成这一任务的方法. 键入命令 # sudo apt-get install o ...

  6. 动态生成图片 保存到OutputStream

    #region 把图片Copy到输出流 //获得图片全路径 string path = context.Server.MapPath("~/img/158_003.jpg"); / ...

  7. Hadoop中的InputFormat解析

    1.InputFormat InputFormat是Hadoop平台上Mapreduce输入的规范,仅有两个抽象方法. List<InputSplit> getSplits(), 获取由输 ...

  8. JTA事务管理--配置剖析

    概述    [IT168 专稿]Spring 通过AOP技术可以让我们在脱离EJB的情况下享受声明式事务的丰盛大餐,脱离Java EE应用服务器使用声明式事务的道路已经畅通无阻.但是很大部分人都还认为 ...

  9. EasyHook远注简单监控示例 z

    http://www.csdn 123.com/html/itweb/20130827/83559_83558_83544.htm 免费开源库EasyHook(inline hook),下面是下载地址 ...

  10. HDU 5730 Shell Necklace cdq分治+FFT

    题意:一段长为 i 的项链有 a[i] 种装饰方式,问长度为n的相连共有多少种装饰方式 分析:采用dp做法,dp[i]=∑dp[j]*a[i-j]+a[i],(1<=j<=i-1) 然后对 ...