zoukankan      html  css  js  c++  java
  • C#编写最小化时隐藏为任务栏图标

    C#编写最小化时隐藏为任务栏图标的Window appllication.
    1.设置WinForm窗体属性showinTask=false

    2.加notifyicon控件notifyIcon1,为控件notifyIcon1的属性Icon添加一个icon图标。

    3.添加窗体最小化事件(首先需要添加事件引用):

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

    //上面一行是主窗体InitializeComponent()方法中需要添加的引用

    private void Form1_SizeChanged(object sender, EventArgs e)
    {
    if (this.WindowState==FormWindowState.Minimized)
    {
    this.Hide();
    this.notifyIcon1.Visible=true;
    }

    }
    4.添加点击图标事件(首先需要添加事件引用):

    private void notifyIcon1_Click(object sender, EventArgs e)
    {
    this.Visible = true;

    this.WindowState = FormWindowState.Normal;

    this.notifyIcon1.Visible = false;

    本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ycl111/archive/2006/08/22/1105517.aspx

  • 相关阅读:
    View Controller 生命周期的各个方法的用法
    IOS开发之Post 方式获取服务器数据
    委托代理
    Function
    SKPhysicsContactDelegate协议
    UITouch附加
    Remove Duplicates from Sorted Array II
    4Sum
    [Text Justification
    Count and Say
  • 原文地址:https://www.cnblogs.com/ewyb/p/1636728.html
Copyright © 2011-2022 走看看