文件名称:csharptraysrc
- 所属分类:
- C#编程
- 资源属性:
- [Windows] [Visual.Net] [源码]
- 上传时间:
- 2013-05-22
- 文件大小:
- 31kb
- 下载次数:
- 0次
- 提 供 者:
- tpu****
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
C#系统托盘程序示例源代码,知识点:
1、添加一个 NotifyIcon 组件和一个 ContextMenuStrip组件到主窗体
2、设置notifyIcon1控件的ContextMenuStrip属性为 contextMenuStrip1,将用户单击托盘图标显示的菜单指向 contextMenuStrip1
3、notifyIcon1.Visible = true //显示托盘图标
4、this.ShowIcon = true //应用程序窗口是否显示图标
5、this.ShowInTaskbar = true //是否在windows任务栏显示图标
6、this.WindowState = FormWindowState.Normal //设置窗口的显示状态(最大化、最小化和普通模式)
7、form2.Owner = this //设置拥有此窗体的窗体,this代表主窗体附属窗体随主窗体的显示而显示
form2.ShowInTaskbar = false
form2.Show()
8、Form1 formmain = new Form1() //form2的窗体关闭并显示form1窗体
formmain = (Form1)this.Owner //将全局变量this.Owner强制转换给FormMain类型-C# system tray program source code examples and knowledge points: 1, add a NotifyIcon component and a ContextMenuStrip component to the main form 2, set the control' s ContextMenuStrip property notifyIcon1 contextMenuStrip1, the user clicks on the tray icon to display a menu point contextMenuStrip1 3, notifyIcon1 . Visible = true // display the tray icon 4, this.ShowIcon = true // application window is displayed icons 5, this.ShowInTaskbar = true // whether to display an icon in the windows task bar 6, this.WindowState = FormWindowState . Normal // set the window display state (maximize, minimize and normal mode) 7, form2.Owner = this // set form with this form, this form represents the main form affiliated with the main window body of the display and display form2.ShowInTaskbar = false form2.Show () 8, Form1 formmain = new Form1 () // form2 and show form1 form closed form formmain = (Form1) this.Owner // The global variable this.Owner cast to type FormMain
1、添加一个 NotifyIcon 组件和一个 ContextMenuStrip组件到主窗体
2、设置notifyIcon1控件的ContextMenuStrip属性为 contextMenuStrip1,将用户单击托盘图标显示的菜单指向 contextMenuStrip1
3、notifyIcon1.Visible = true //显示托盘图标
4、this.ShowIcon = true //应用程序窗口是否显示图标
5、this.ShowInTaskbar = true //是否在windows任务栏显示图标
6、this.WindowState = FormWindowState.Normal //设置窗口的显示状态(最大化、最小化和普通模式)
7、form2.Owner = this //设置拥有此窗体的窗体,this代表主窗体附属窗体随主窗体的显示而显示
form2.ShowInTaskbar = false
form2.Show()
8、Form1 formmain = new Form1() //form2的窗体关闭并显示form1窗体
formmain = (Form1)this.Owner //将全局变量this.Owner强制转换给FormMain类型-C# system tray program source code examples and knowledge points: 1, add a NotifyIcon component and a ContextMenuStrip component to the main form 2, set the control' s ContextMenuStrip property notifyIcon1 contextMenuStrip1, the user clicks on the tray icon to display a menu point contextMenuStrip1 3, notifyIcon1 . Visible = true // display the tray icon 4, this.ShowIcon = true // application window is displayed icons 5, this.ShowInTaskbar = true // whether to display an icon in the windows task bar 6, this.WindowState = FormWindowState . Normal // set the window display state (maximize, minimize and normal mode) 7, form2.Owner = this // set form with this form, this form represents the main form affiliated with the main window body of the display and display form2.ShowInTaskbar = false form2.Show () 8, Form1 formmain = new Form1 () // form2 and show form1 form closed form formmain = (Form1) this.Owner // The global variable this.Owner cast to type FormMain
(系统自动生成,下载前可以参看下载内容)
下载文件列表
csharptraysrc\系统托盘程序示例\26.ico
.............\................\Form1.cs
.............\................\Form1.Designer.cs
.............\................\Form1.resx
.............\................\FormMain.cs
.............\................\FormMain.Designer.cs
.............\................\FormMain.resx
.............\................\Program.cs
.............\................\...perties\AssemblyInfo.cs
.............\................\..........\Resources.Designer.cs
.............\................\..........\Resources.resx
.............\................\..........\Settings.Designer.cs
.............\................\..........\Settings.settings
.............\................\系统托盘程序示例.csproj
.............\系统托盘程序示例.sln
.............\系统托盘程序示例.suo
.............\................\Properties
.............\系统托盘程序示例
csharptraysrc