Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
how to go through this article? the writer is not rplying can any expert help us out
Minimize window to system tray[^]
 
First I drag a notifyicon from toolbox to form, and set the icon in property. Then I paste your code to the form as below:
 
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
 
namespace minimizeTray
{
public partial class TrayMinimizerForm : Form
{
 
 
 
 
public TrayMinimizerForm()
{
InitializeComponent();
}
 
private void TrayMinimizerForm_Load(object sender, EventArgs e)
{
 
}
 
private void TrayMinimizerForm_Resize(object sender, EventArgs e)
{
notifyIcon1.BalloonTipTitle = "Minimize to Tray App";
notifyIcon1.BalloonTipText = "You have successfully minimized your form.";
 
if (FormWindowState.Minimized == this.WindowState)
{
notifyIcon1.Visible = true;
notifyIcon1.ShowBalloonTip(500);
this.Hide();
}
else if (FormWindowState.Normal == this.WindowState)
{
notifyIcon1.Visible = false;
}
}
 
private void notifyIcon1_MouseDoubleClick(object sender, MouseEventArgs e)
{
this.Show();
this.WindowState = FormWindowState.Normal;
}
}
}
is there anything else which i forgot?
thanks in advance
Posted 24-Sep-12 9:24am
sariqkhan1.4K
Comments
Lakhan Aanjana at 24-Sep-12 15:29pm
   
if u r getting any error message please let me know?
sariqkhan at 24-Sep-12 15:43pm
   
no there is no errors but the problem is when form is clicked on minimized it goes to hidden in the system. but the actual coding is form should go in system tray. and a ballon messsage will shows up
Minimize to Tray App
you have successfully minimized your form.
which is not happening. is there some problem in code?

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You need to set event of your form ReSize to >> TrayMinimizerForm_Resize code
  Permalink  
Comments
sariqkhan at 25-Sep-12 5:53am
   
it is the form resize event only
Kuthuparakkal at 25-Sep-12 5:58am
   
Debug with break points on on the event and find what's happenin there?
sariqkhan at 25-Sep-12 13:54pm
   
what will break point do?
Marcus Kramer at 25-Sep-12 14:18pm
   
A break point will allow you to debug your code to find out where the problems are. See this for details.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 338
1 _Amy 290
2 Maciej Los 260
3 Manfred R. Bihy 200
4 OriginalGriff 195
0 OriginalGriff 7,445
1 Sergey Alexandrovich Kryukov 6,347
2 Maciej Los 3,799
3 Peter Leow 3,558
4 CHill60 2,702


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 26 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100