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

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() {…
WinForm 之 窗口最小化到托盘及右键图标显示菜单 Form最小化是指整个Form都缩小到任务栏上,但是窗体以Form的标题栏形式显示在任务栏上, 若是想让Form以Icon的形式显示在任务栏右下角,则需要给Form添加一个NotifyIcon控件. 一.添加NotifyIcon控件 1 如下图为窗体添加一个 NotifyIcon 控件,并指定 Icon 和 Text 属性,如下图: 2 在需要窗体最小化到托盘的处理代码中,添加如下代码: if(this.WindowState==FormW…
private void PrintService_SizeChanged(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) { this.Hide(); this.notifyIcon.Visible = true; } } private void PrintService_FormClosing(object sender, FormClosingEventArgs e) { i…
首先,先拖一个NotifyIcon到主窗体,然后设置NotifyIcon的图标,不然等下最小化后,都找不到那个程序了,还有那个Text也是,不写名字,就默认是NotifyIcon了..如下图: 然后双击NotifyIcon,代码如下:         /// <summary>         /// 添加双击托盘图标事件(双击显示窗口)         /// </summary>         /// <param name="sender">…
实现前先拉一个notifyIcon控件,在Icon属性中加入一个ICON小图标,然后具体的代码实现如下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Not…
1.拖取NotifyIcon控件.将该控件的visible设成false. 2.指定NotifyIcon的Icon(很重要,否则最小化后找不到窗口). 3.找到window的SizeChanged事件: private void Form1_SizeChanged(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Minimized) { this.ShowInTaskbar = false; //不显示在…
1.拉出一个notifyIcon1到用户界面,也可以NEW一个 2.拉出一个ContextMenuStrip控件,命名为mymenu,集合中增加退出 3.notifyIcon1的属性ContextMenuStrip 增加 myMenu;或者this.notifyIcon1.ContextMenuStrip = myMenu; private void FrmMain_Load(object sender, EventArgs e) { //最小化到托盘 // this.notifyIcon1 =…
最近编写一个工具发现的问题,窗体不论是最小化还是进入托盘,重新打开的时候都会进入控件load事件. 产生这个现象的条件是: 1.使用了用户控件,在控件中使用了load事件 2.在主窗体中,隐藏或显示任务栏区图表 满足这两个条件,会导致主窗体最小化时,用户控件重复进入load事件.…
01.//先拖一个notifyIcon控件进来 02. 03.//然后在您的notifyIcon控件中添加 MouseDoubleClick事件,代码如下 04. 05. private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e) 06.{ 07.this.notifyIcon1.Visible = false; 08.base.ShowInTaskbar = true; 09.this.Activate(…
public PrintService() { InitializeComponent(); this.WindowState = FormWindowState.Minimized; } private void PrintService_Load(object sender, EventArgs e) { //初始化是不可见的 //notifyIcon.Visible = false; } protected override void OnClosing(CancelEventArgs e…