Tutorials
Resources
Forum
Communities
Interview
Jobs
Projects
Offshore Development
Silverlight Tutorials
|
Mentor
|
Code Converter
|
Articles
|
Code Factory
|
Computer Jokes
|
Members
|
Peer Appraisal
|
IT Companies
|
Bookmarks
|
Revenue Sharing
|
Prizes & Awards
My Profile
Sign In
Register
AdSense Revenue
Active Members
Today
srinivasa reddy...
(25)
Tejinder Singh ...
(16)
Babu Akkandi
(16)
Last 7 Days
Appukuttan
(620)
Babu Akkandi
(453)
Tejinder Singh ...
(267)
more...
New Feature:
Community Sites
:
Create your own .NET community website and start earning from Google AdSense !
It's Free !
Adding your application to the System Tray on minimization
Posted Date: 21 May 2008
Resource Type:
Code Snippets
Category:
Application windows, menus & toolbars
Author:
Payal Jain
Member Level:
Gold
Rating:
Points
: 10
Introduction
This code will help you to add your application to the System Tray. and then restore it from the icon displayed in the system tray.
Control used
notifyIcon control is used to add your application to System Tray.
description and code
1. first of all open your existing application.
2. drag and drop NotifyIcon control on to the form. note: it will be placed below the form as it has no visual representation of itself.
3.now set some properties of notifyIcon control:
Name: as you want to name it . by default it is notifyIcon1.
Text: the text you want to appear as a user points to the icon in the system tray.
Icon: the icon to be displayed for the application in the system tray.
4.Add an event handler for the forms resize event handler and place the code as below.
private void SystemTrayIcon_Resize(object sender, EventArgs e)
{
if (FormWindowState.Minimized == WindowState)
{
Hide();
}
}
this will add an icon to the application in the system tray when user clicks the minimize button.
5. to restore the application on double clicking the system tray icon. add an event handler for notifyIcon double click event and write the code as:
private void notifyIcon1_DoubleClick(object sender, EventArgs e)
{
Show();
WindowState= FormWindowState.Normal;
}
6.you can also add context menu on right click of notifiIcon in system tray.for that design a contextmenuStrip and specify contextmenuStrip id in contextMenuStrip Property of notifyIcon control.
7.you can also add ballontip displyed on minimizing the application to system tray for that you will need to call showballontip() method on notifyIcon control before hide() function in resize event handler for the form.
Responses
No responses found. Be the first to respond and make money from
revenue sharing program
.
Feedbacks
Popular Tags
What are tags ?
Search Tags
Sign In
(No tags found.)
Post Feedback
This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must
Sign In
to post a response.
Next Resource:
How to start Tarantella Native Client from Command line
Previous Resource:
Add your application name to the Windows Context Menu
Return to Discussion Resource Index
Post New Resource
Category:
Application windows, menus & toolbars
Post resources and
earn money
!
Related Resources
Example on Globalisation using C#.Net
Implementation of Single inheritance
List out Directory and Files in the Drive with size in Tree formate
How to use Tooltip to your project
ADDING AND INSERTING ITEMS TO A LISTBOX AT RUNTIME
dotNet Slackers
BizTalk Adaptors
Web Design
Contact Us
Privacy Policy
Terms Of Use