Click here to Skip to main content
15,899,679 members
Home / Discussions / C#
   

C#

 
GeneralLaunch a programm from an application Pin
Matthieu.C29-Oct-03 22:31
Matthieu.C29-Oct-03 22:31 
GeneralRe: Launch a programm from an application Pin
Corinna John30-Oct-03 2:37
Corinna John30-Oct-03 2:37 
QuestionRichTextBox?? Pin
electronicm29-Oct-03 21:38
electronicm29-Oct-03 21:38 
AnswerRe: RichTextBox?? Pin
Mazdak30-Oct-03 5:43
Mazdak30-Oct-03 5:43 
GeneralRe: RichTextBox?? Pin
Judah Gabriel Himango30-Oct-03 9:15
sponsorJudah Gabriel Himango30-Oct-03 9:15 
QuestionHow to beautify Progress Bar? Pin
softair29-Oct-03 21:19
softair29-Oct-03 21:19 
AnswerRe: How to beautify Progress Bar? Pin
Heath Stewart30-Oct-03 3:00
protectorHeath Stewart30-Oct-03 3:00 
GeneralProblems on NiceMenu Pin
softair29-Oct-03 21:10
softair29-Oct-03 21:10 
Hello!

I would like to beautify my menuitem for the SystemTray Example, does it possible? But it always show "int numOldMenu = myMenu.Count;" has problem? Why?

The coding of SystemTrayExample is listed as following:

using System;
using System.Drawing;
using System.Resources;
using System.ComponentModel;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Threading ;
using Utility.NiceMenu;

namespace Demo
{

public class SystemTray : System.Windows.Forms.Form
{
private System.Windows.Forms.NotifyIcon WSNotifyIcon;
private System.ComponentModel.IContainer components;
private Icon mDirIcon = new Icon(typeof(SystemTray).Assembly.GetManifestResourceStream("SystemTrayExample.FLGUSA02.ICO"));

//private NiceMenu myMenu ;

public SystemTray()
{
//constructor for the form
InitializeComponent();

//keep the form hidden
this.Hide();
//OnMyMenu();

//InitializeNotifyIcon();

NiceMenu myNiceMenu = new NiceMenu();

myNiceMenu.UpdateMenu (this.ContextMenu ,new NiceMenuClickEvent (InitializeNotifyIcon));

}

///
/// Clean up any resources being used.
///

protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.WSNotifyIcon = new System.Windows.Forms.NotifyIcon(this.components);
//
// WSNotifyIcon
//
this.WSNotifyIcon.Text = "";
this.WSNotifyIcon.Visible = true;
//this.WSNotifyIcon.MouseDown += new System.Windows.Forms.MouseEventHandler(this.WSNotifyIcon_MouseDown);
//
// SystemTray
//
this.AccessibleRole = System.Windows.Forms.AccessibleRole.None;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(8, 7);
this.ControlBox = false;
this.Enabled = false;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SystemTray";
this.Opacity = 0;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.Manual;

}
#endregion

///
/// The main entry point for the application.
///

[STAThread]
static void Main()
{
Application.Run(new SystemTray());
}


public void ExitControlForm(object sender, EventArgs e)
{
//Hide the NotifyIcon.
WSNotifyIcon.Visible=false;

this.Close();

}


//private void InitializeNotifyIcon()
private void InitializeNotifyIcon(object sender, System.EventArgs e)
{
//setup the Icon
NotifyIcon WSNotifyIcon = new NotifyIcon();
WSNotifyIcon.Icon = mDirIcon;
WSNotifyIcon.Text = "System Tray Example";
WSNotifyIcon.Visible = true;


//Create the submenus - any number will do
MenuItem[] subMnuItems1 = new MenuItem[3];
subMnuItems1[0] = new MenuItem("Submenu 1", new EventHandler(this.ExitControlForm));
subMnuItems1[1] = new MenuItem("Submenu 2", new EventHandler(this.ExitControlForm));
subMnuItems1[2] = new MenuItem("Submenu 3", new EventHandler(this.ExitControlForm));

//Create the MenuItem objects and add them to
//the context menu of the NotifyIcon.
MenuItem[] mnuItems = new MenuItem[3];

//create the menu items array
mnuItems[0] = new MenuItem("Sub Menu Items");
mnuItems[0].MenuItems.AddRange(subMnuItems1);
mnuItems[0].DefaultItem=true;
mnuItems[1] = new MenuItem("-");
mnuItems[2] = new MenuItem("Exit", new EventHandler(this.ExitControlForm));


//add the menu items to the context menu of the NotifyIcon
ContextMenu notifyIconMenu = new ContextMenu(mnuItems);
WSNotifyIcon.ContextMenu=notifyIconMenu;

}



}
}



fm Softair
GeneralRe: Problems on NiceMenu Pin
Heath Stewart30-Oct-03 3:09
protectorHeath Stewart30-Oct-03 3:09 
GeneralIncreasing Functionality Pin
jtmtv1829-Oct-03 19:59
jtmtv1829-Oct-03 19:59 
GeneralRe: Increasing Functionality Pin
Heath Stewart30-Oct-03 3:07
protectorHeath Stewart30-Oct-03 3:07 
GeneralRe: Increasing Functionality Pin
jtmtv1830-Oct-03 11:01
jtmtv1830-Oct-03 11:01 
QuestionHow to build a discussion board using c# and ASP.NEt Pin
Ranze Dobbins29-Oct-03 7:07
Ranze Dobbins29-Oct-03 7:07 
AnswerRe: How to build a discussion board using c# and ASP.NEt Pin
Not Active29-Oct-03 8:53
mentorNot Active29-Oct-03 8:53 
AnswerRe: How to build a discussion board using c# and ASP.NEt Pin
Mike Ellison29-Oct-03 14:25
Mike Ellison29-Oct-03 14:25 
GeneralCustom Cursor from Bytes Pin
jspano29-Oct-03 5:49
jspano29-Oct-03 5:49 
GeneralRe: Custom Cursor from Bytes Pin
Heath Stewart29-Oct-03 11:12
protectorHeath Stewart29-Oct-03 11:12 
GeneralRe: Custom Cursor from Bytes Pin
jspano30-Oct-03 1:37
jspano30-Oct-03 1:37 
GeneralRe: Custom Cursor from Bytes Pin
Heath Stewart30-Oct-03 2:50
protectorHeath Stewart30-Oct-03 2:50 
GeneralSqrt() method Pin
oOomen29-Oct-03 5:33
oOomen29-Oct-03 5:33 
GeneralRe: Sqrt() method Pin
Daniel M. Edwards29-Oct-03 5:40
Daniel M. Edwards29-Oct-03 5:40 
GeneralRe: Sqrt() method Pin
oOomen29-Oct-03 6:13
oOomen29-Oct-03 6:13 
GeneralRe: Sqrt() method Pin
scadaguy29-Oct-03 7:29
scadaguy29-Oct-03 7:29 
GeneralRe: Sqrt() method Pin
oOomen29-Oct-03 9:26
oOomen29-Oct-03 9:26 
GeneralRe: Sqrt() method Pin
Christian Graus29-Oct-03 9:34
protectorChristian Graus29-Oct-03 9:34 

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.