Click here to Skip to main content
15,896,063 members
Home / Discussions / C#
   

C#

 
GeneralEditing bookmarks in Word using late binding Pin
Tommy Fransson28-Nov-04 4:10
Tommy Fransson28-Nov-04 4:10 
GeneralOleDb Connection string password Pin
Anonymous28-Nov-04 3:58
Anonymous28-Nov-04 3:58 
QuestionOpen & close window? Pin
gyokusei28-Nov-04 2:14
gyokusei28-Nov-04 2:14 
AnswerRe: Open & close window? Pin
Stefan Troschuetz28-Nov-04 3:20
Stefan Troschuetz28-Nov-04 3:20 
GeneralObsolete ICodeCompiler interface Pin
thepersonof28-Nov-04 0:28
thepersonof28-Nov-04 0:28 
GeneralRe: Obsolete ICodeCompiler interface Pin
Nick Parker28-Nov-04 5:44
protectorNick Parker28-Nov-04 5:44 
GeneralHiding a form and displaying only a tray icon Pin
CoffeeZombie27-Nov-04 23:42
CoffeeZombie27-Nov-04 23:42 
GeneralRe: Hiding a form and displaying only a tray icon Pin
Skynyrd28-Nov-04 2:41
Skynyrd28-Nov-04 2:41 
use the form's Visible property. U dont need to change BorderStyles or anything.

A sample code could be (in this example I want the app to minimize to taskbar):

private void Form1_LocationChanged(object sender, EventArgs e)
{
if (this.WindowState==FormWindowState.Minimized)
{ notifyIcon1.Visible=true;
this.Visible=false;
}
}

A better solution when ur main form does not serve any purpose as in your case, is to not use any main form at all and create your own ApplicationContext. An example would be:

public class AppStart:System.Windows.Forms.ApplicationContext
{
[STAThread]
static void Main()
{
Application.Run(new AppStart());
}

NotifyIcon myIcon;

public AppStart()
{
myIcon=new NotifyIcon();
myIcon.Icon=SystemIcons.Information;
myIcon.Visible=true;
myIcon.DoubleClick+=new EventHandler(myIcon_DoubleClick);
}

private void myIcon_DoubleClick(object sender, EventArgs e)
{
Form1 myForm=new Form1();
myForm.Closed+=new EventHandler(appForm_Closed);
myForm.Show();
myIcon.Visible=false;
}

private void appForm_Closed(object sender, EventArgs e)
{
((Form)sender).Closed-=new EventHandler(appForm_Closed);
myIcon.Visible=true;
}
}

GeneralRe: Hiding a form and displaying only a tray icon Pin
CoffeeZombie29-Nov-04 23:13
CoffeeZombie29-Nov-04 23:13 
Questionactivate form ? Pin
kendao27-Nov-04 21:36
kendao27-Nov-04 21:36 
Generalget application task Pin
kendao27-Nov-04 21:18
kendao27-Nov-04 21:18 
GeneralRe: get application task Pin
Luis Alonso Ramos28-Nov-04 7:34
Luis Alonso Ramos28-Nov-04 7:34 
Generalrichtextbox problem Pin
kendao27-Nov-04 21:12
kendao27-Nov-04 21:12 
GeneralRe: richtextbox problem Pin
Jay Shankar28-Nov-04 13:56
Jay Shankar28-Nov-04 13:56 
Generalcollection properties in user controls Pin
Anonymous27-Nov-04 19:31
Anonymous27-Nov-04 19:31 
GeneralView&Write Pin
kenes27-Nov-04 13:50
kenes27-Nov-04 13:50 
GeneralRe: View&Write Pin
Corinna John28-Nov-04 3:54
Corinna John28-Nov-04 3:54 
GeneralSimple MAPI can't fill address field Pin
Ray17027-Nov-04 7:47
Ray17027-Nov-04 7:47 
GeneralConvert.FromBase64String(base64String); - ERROR Pin
anderslundsgard27-Nov-04 4:18
anderslundsgard27-Nov-04 4:18 
Generaltraffic system simulation project Pin
Member 148592127-Nov-04 3:50
Member 148592127-Nov-04 3:50 
GeneralRe: traffic system simulation project Pin
Colin Angus Mackay27-Nov-04 14:54
Colin Angus Mackay27-Nov-04 14:54 
Generallogging package Pin
mathon27-Nov-04 3:32
mathon27-Nov-04 3:32 
Generalcolumn wise display in datagrid Pin
imarehan27-Nov-04 3:03
imarehan27-Nov-04 3:03 
QuestionHow to write a Grid Pin
Mehdy Khoshrou27-Nov-04 2:19
Mehdy Khoshrou27-Nov-04 2:19 
AnswerRe: How to write a Grid Pin
Nick Parker27-Nov-04 4:28
protectorNick Parker27-Nov-04 4:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.