需求:winform应用程序,当隐藏到托盘时,再次运行exe程序,让其只运行一个实例,并且把窗口从托盘中显示出来 应用程序名可以通过下面代码,获取到: Process current = Process.GetCurrentProcess(); strProcessName = current.ProcessName; static class Program { private static string strProcessName = "Form1" ; private stat
1,显示窗体 非模式: Form form = new Form(); form.Show(); 模式: Form form = new Form(); form.Show(); 2,拥有者窗体与附属窗体 模式:建立隐式的拥有着与附属关系 非模式:不建立隐式附属关系,但可以显式指定 OwnedForm form = new OwnedForm(); form.Owner = this; form.Show(); 或者更简单的: OwnedForm form = new OwnedForm()
WPF控件--NotifyIcon 运行界面如下所示: 图1 图2 代码很少,如下所示: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> using System; using System.Windows; using System.
实现前先拉一个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