.Net Interview Question:- Adding your window application icon to the task bar ?
- By Shiv Prasad Koirala in C#
- Aug 21st, 2011
.Net Interview Question:- Adding your window application icon to the task bar?
This is not one of the .NET typical interview question but as a developer you would be interested in knowing that how to add your windows application icon in to the task bar.
Let's demonstrate a simple example to see how exactly you can add your windows application icon in the task bar.
In order to achieve the above subject just follow the following steps.
Step1: - create a windows application for that Go To > File > New > Project > Windows > Select Windows Forms Application.
Step2: - Now from the toolbox just add the "NotifyIcon" control to the main form.
Step3: - Go to the properties of the NotifyIcon control and set the properties like below diagram.
In the above diagram you can see that I have set the following properties.
BalloonTipIcon = Warning.
BalloonTipText = Click to enlarge.
BalloonTipTitle = Message.
Note: - please select an icon with .ico extension with maximum size of 48 * 48.
Step4: - Add a Button on the form and add the below code snippet in to Form1.cs.
private void button1_Click(object sender, EventArgs e) notifyIcon1.ShowBalloonTip(1); this.Visible = false; }
Once you have completed with all the above steps now just run your application and will see that the selected application icon is now being added to the task bar to the right bottom of your screen like below diagram.
In above diagram you can clearly see that now the application icon is being added to the task bar.
Now, when you click on the Button1 you will see a message pops up like below diagram as we have declared to the properties of the NotifyIcon control.
Also view our video of C# interview questions on Garbage Collector as follows: -
Visit us for more tutorials on important .NET interview questions
Get more Dotnet interview questions and answers from author's blog
Shiv Prasad Koirala
Visit us @ www.questpond.com or call us at 022-66752917... read more