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
Your Filters
Interested
Ignored
     
0 Shai Vashdi 480
1 Tadit Dash 305
2 Sergey Alexandrovich Kryukov 250
3 Peter Leow 190
4 OriginalGriff 163
0 Sergey Alexandrovich Kryukov 9,435
1 OriginalGriff 5,498
2 Peter Leow 4,230
3 Maciej Los 3,540
4 Abhinav S 3,353


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