|
-
Apr 23rd, 2004, 03:33 AM
#1
Thread Starter
Addicted Member
NotifyIcon without a Form
Hi,
I would like to write an app that is just a NotifyIcon - without a main form. I have tried to call "Hide()" methods of my main form but it doesn't hide! I have also tried writing a standard app without the Form (just code) but I can't get hold of the NotifyIcon as it seems to be wrapped to a form in the framework.
Does anybody know how to do this or have an example of how I may do this?
Many thanks in advance,
DJ
-
Apr 23rd, 2004, 04:08 AM
#2
Hyperactive Member
Dont know if its possible to have just a notify icon, but you can hide your main form like this
Code:
sysTrayIcon.Visible = true;
this.Visible = false;
I know, just a workaround, but it worked for me.
HTH, Stephan
Keep Smiling - even if its hard 
Frankie Says Relax, wossname Says Yeah!
wossname:--Currently I'm wearing a gimp suit and a parachute.
C# - Base64 Blog
-
Mar 16th, 2005, 10:15 AM
#3
New Member
Re: NotifyIcon without a Form
You can create a class like this
Code:
class CNotify
{
System.ComponentModel.Container componentes;
System.Windows.Forms.NotifyIcon ni;
System.Drawing.Icon Icono;
public CNotify()
{
Inicializa();
}
private void Inicializa()
{
Icono= new Icon(GetType(), "post1_1.ico");
componentes= new System.ComponentModel.Container();
ni= new NotifyIcon(componentes);
ni.Text= "Test Notify Icon";
ni.Icon= Icono;
ni.Visible= true;
ni.Click+=new EventHandler(ni_Click);
}
private void ni_Click(object sender, EventArgs e)
{
MessageBox.Show("Click in NotifyIcon");
}
}
and in the start point of the application write this.
Code:
[STAThread]
static void Main()
{
CNotify test;
test= new CNotify();
Application.Run();
}
if you want to end the application just send exit.
Disculpen si tengo un error en mi ingles, trato de escribir lo mejor que puedo.
No te  se 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|