Click here to Skip to main content
15,905,028 members
Home / Discussions / C#
   

C#

 
GeneralLinkButton Pin
ruifernandes2428-Nov-04 9:30
ruifernandes2428-Nov-04 9:30 
GeneralRe: LinkButton Pin
Luis Alonso Ramos28-Nov-04 10:02
Luis Alonso Ramos28-Nov-04 10:02 
GeneralFile IO Pin
StephenMcAllister28-Nov-04 8:18
StephenMcAllister28-Nov-04 8:18 
GeneralRe: File IO Pin
Robin Panther28-Nov-04 15:59
Robin Panther28-Nov-04 15:59 
QuestionNodes? Pin
Jerry Hammond28-Nov-04 5:19
Jerry Hammond28-Nov-04 5:19 
AnswerRe: Nodes? Pin
Alex Korchemniy28-Nov-04 9:21
Alex Korchemniy28-Nov-04 9:21 
AnswerRe: Nodes? Pin
Yulianto.28-Nov-04 21:31
Yulianto.28-Nov-04 21:31 
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 

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.