当前位置: 首页>>代码示例>>C#>>正文


C# Forms.NotifyIcon类代码示例

本文整理汇总了C#中System.Windows.Forms.NotifyIcon的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms.NotifyIcon类的具体用法?C# System.Windows.Forms.NotifyIcon怎么用?C# System.Windows.Forms.NotifyIcon使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


System.Windows.Forms.NotifyIcon类属于命名空间,在下文中一共展示了System.Windows.Forms.NotifyIcon类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateNotificationIcon

        private void CreateNotificationIcon()
        {
            DestroyNotificationIcon();

            _notifyIcon = new System.Windows.Forms.NotifyIcon
            {
                BalloonTipTitle = Properties.Resources.NotifierTitle,
                Text = Properties.Resources.NotifierTitle
            };

            var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("GoogleCalendarReminder.Resources.calendar.ico");
            if (stream != null)
            {
                _notifyIcon.Icon = new Icon(stream);
            }

            _notifyIcon.DoubleClick += NotifyIconClick;

            _notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu();
            _notifyIcon.ContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("Refresh Calendars", OnRefresh));
            _notifyIcon.ContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("Upcoming Events...", OnUpcomingEvents));
            _notifyIcon.ContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("Settings...", new EventHandler(OnSettings)));
            _notifyIcon.ContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("-"));
            _notifyIcon.ContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("View Project Page...", OnLaunchProjectPage));
            _notifyIcon.ContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("View Issue Log...", OnViewLog));
            _notifyIcon.ContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("-"));
            _notifyIcon.ContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("About...", OnAbout));
            _notifyIcon.ContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("-"));
            _notifyIcon.ContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("Exit", OnExit));

            _notifyIcon.Visible = true;
        }
开发者ID:cyndilou,项目名称:CalendarReminderApp,代码行数:32,代码来源:NotificationService.cs

示例2: InitializeComponent

		/// <summary>
		/// This method is required for Windows Forms designer support.
		/// Do not change the method contents inside the source code editor. The Forms designer might
		/// not be able to load this method if it was changed manually.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
			this.SuspendLayout();
			// 
			// notifyIcon1
			// 
			this.notifyIcon1.Icon = global::StickyNotesWall.Resource1.favicon;
			this.notifyIcon1.Text = "Ocean Notes\' Wall";
			this.notifyIcon1.Visible = true;
			this.notifyIcon1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.NotifyIcon1MouseClick);
			// 
			// StartingWindow
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.ClientSize = new System.Drawing.Size(314, 62);
			this.ControlBox = false;
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
			this.Icon = global::StickyNotesWall.Resource1.favicon;
			this.Name = "StartingWindow";
			this.ShowIcon = false;
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "StartingWindow";
			this.WindowState = System.Windows.Forms.FormWindowState.Minimized;
			this.ResumeLayout(false);

		}
开发者ID:SommerEngineering,项目名称:OceanNotesWall,代码行数:35,代码来源:StartingWindow.Designer.cs

示例3: TrayIcon

        public TrayIcon()
        {
            _trayIcon = new System.Windows.Forms.NotifyIcon();
            _trayIcon.ContextMenu = new System.Windows.Forms.ContextMenu();

            var aboutString = EarTrumpet.Properties.Resources.ContextMenuAboutTitle;
            var version = Assembly.GetEntryAssembly().GetName().Version;
            _trayIcon.ContextMenu.MenuItems.Add(String.Format("{0} Ear Trumpet {1} ...", aboutString, version));
            _trayIcon.ContextMenu.MenuItems[0].Click += About_Click;

            _trayIcon.ContextMenu.MenuItems.Add(EarTrumpet.Properties.Resources.ContextMenuShowDesktopAppsTitle);
            _trayIcon.ContextMenu.MenuItems[1].Checked = UserPreferencesService.ShowDesktopApps;
            _trayIcon.ContextMenu.MenuItems[1].Click += ShowDesktopApps_Click;
                
            _trayIcon.ContextMenu.MenuItems.Add("-");

            _trayIcon.ContextMenu.MenuItems.Add(EarTrumpet.Properties.Resources.ContextMenuExitTitle);
            _trayIcon.ContextMenu.MenuItems[3].Click += Exit_Click;

            _trayIcon.MouseClick += TrayIcon_MouseClick;
            _trayIcon.Icon = new System.Drawing.Icon(Application.GetResourceStream(new Uri("pack://application:,,,/EarTrumpet;component/Tray.ico")).Stream);

            var tooltipString = EarTrumpet.Properties.Resources.ContextMenuTooltip;
            _trayIcon.Text = String.Format("Ear Trumpet - {0}", tooltipString);
            _trayIcon.Visible = true;
        }
开发者ID:RemiGC,项目名称:EarTrumpet,代码行数:26,代码来源:TrayIcon.cs

示例4: Start

		public static void Start(EventHandler onShow, EventHandler onClose, EventHandler onShowLogs)
		{
			RefreshTaskbarNotificationArea();
			AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
			_notifyIcon = new System.Windows.Forms.NotifyIcon();
			Stream iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/ServerFS2;component/FS2.ico")).Stream;
			_notifyIcon.Icon = new System.Drawing.Icon(iconStream);
			_notifyIcon.Visible = true;

			_notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu();
			var menuItem1 = new System.Windows.Forms.MenuItem();
			menuItem1.Text = "Показать";
			menuItem1.Click += new EventHandler(onShow);
			_notifyIcon.ContextMenu.MenuItems.Add(menuItem1);

			var menuItem2 = new System.Windows.Forms.MenuItem();
			menuItem2.Text = "Выход";
			menuItem2.Click += new EventHandler(onClose);
			_notifyIcon.ContextMenu.MenuItems.Add(menuItem2);

			var menuItem3 = new System.Windows.Forms.MenuItem();
			menuItem3.Text = "Логи";
			menuItem3.Click += new EventHandler(onShowLogs);
			_notifyIcon.ContextMenu.MenuItems.Add(menuItem3);

			_notifyIcon.Text = "Сервер FS2";
		}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:27,代码来源:NotifyIconService.cs

示例5: ServerWindow

 public ServerWindow()
 {
     InitializeComponent();
     Closing += ServerWindow_Closing;
     isConfigured = false;
     isConnected = false;
     isServerActive = false;
     passwordChanged = false;
     notifyServer = new System.Windows.Forms.NotifyIcon();
     notifyServer.MouseClick += new System.Windows.Forms.MouseEventHandler(notifyServer_mouseClickEvent);
     notifyServer.MouseMove += new System.Windows.Forms.MouseEventHandler(notifyServer_MouseMove);
     path = Directory.GetCurrentDirectory().Remove(Directory.GetCurrentDirectory().Length - 9);
     notifyServer.Icon = new System.Drawing.Icon(path + "\\Punto_rosso.ico");
     status = new StatusWindow(this);
     this.WindowState = WindowState.Normal;
     this.ShowInTaskbar = true; //cosi non compare l'icona
     notifyServer.Visible = true;
     notifyServer.BalloonTipTitle = "Server AVVIATO";
     notifyServer.BalloonTipText = "Caricate le impostazioni di default\nPremi START per mettere il server in attesa di connessioni";
     notifyServer.ShowBalloonTip(300);
     connectionParameter = new ConnectionParameter();
     dispatcherTimer = new System.Windows.Threading.DispatcherTimer();
     //questo metodo mi serve per inserire tutti gli indirizzi presente sulla macchina server
     caricaInfoIndirizzoServer();
     caricaInfoTextBox();
     stopButton.IsEnabled = false;
     stateLabel.Content = NON_CONNESSO;
     contHour = 0;
     contMin = 0;
     contSec = 0;
 }
开发者ID:giu-fio,项目名称:remote-control-server,代码行数:31,代码来源:ServerWindow.xaml.cs

示例6: Main

        public Main()
        {
            InitializeComponent();

            System.Windows.Forms.ContextMenu systemTrayContextMenu = new System.Windows.Forms.ContextMenu();
            systemTrayContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("Reports", new EventHandler(Reports_Click)));
            systemTrayContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("Settings", new EventHandler(Settings_Click)));
            systemTrayContextMenu.MenuItems.Add(new System.Windows.Forms.MenuItem("Exit", new EventHandler(Exit_Click)));

            SystemTrayIcon = new System.Windows.Forms.NotifyIcon();
            SystemTrayIcon.ContextMenu = systemTrayContextMenu;
            SystemTrayIcon.Visible = true;
            SystemTrayIcon.Icon = new Icon(SystemIcons.Application, 40, 40);
            SystemTrayIcon.Text = "Slacking off";
            SystemTrayIcon.BalloonTipTitle = "Get Back To Work";
            SystemTrayIcon.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info;
            SystemTrayIcon.Click += new EventHandler(SystemTrayIcon_Click);

            Hide();

            Left = System.Windows.SystemParameters.PrimaryScreenWidth - Width - 5;
            Top = 5;

            DateStarted = null;
            LoadSettings();
        }
开发者ID:colourblind,项目名称:GetBackToWork,代码行数:26,代码来源:Main.xaml.cs

示例7: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            System.Windows.Forms.NotifyIcon ni = new System.Windows.Forms.NotifyIcon();

            System.IO.Stream iconStream = Application.GetResourceStream(new Uri("pack://application:,,,/Icons/App.ico")).Stream;
            ni.Icon = new System.Drawing.Icon(iconStream);

            ni.Visible = true;
            ni.DoubleClick +=
                delegate (object sender, EventArgs args)
                {
                    Show();
                    WindowState = WindowState.Normal;
                };

            // and hide
            Hide();

            // register to run at startup
            RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
            if (rkApp.GetValue("MachMultimediaKeysMapper") == null)
            {
                rkApp.SetValue("MachMultimediaKeysMapper", System.Reflection.Assembly.GetExecutingAssembly().Location);
            }
        }
开发者ID:machv,项目名称:multimedia-keys-mapper,代码行数:27,代码来源:MainWindow.xaml.cs

示例8: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            _myNotifyIcon = new System.Windows.Forms.NotifyIcon {Icon = new System.Drawing.Icon("rss.ico")};
            _myNotifyIcon.MouseDoubleClick += (a, b) => WindowState = WindowState.Normal;
            _myNotifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(
                new[]
                {
                    new MenuItem("Open", (a, b) => WindowState = WindowState.Normal),
                    new MenuItem("-"),
                    new MenuItem(
                        "Exit",
                        (a, b) =>
                        {
                            _myNotifyIcon.Visible = false;
                            Close();
                        })
                });

            PopulateQualities();

            _localIp = Dns.GetHostEntry(Dns.GetHostName()).
                AddressList.First(ip => ip.AddressFamily == AddressFamily.InterNetwork).ToString();

            var address = Settings.Default.OverrideNetworkSettings ? Settings.Default.HostName : _localIp;
            var port = Settings.Default.OverrideNetworkSettings ? Settings.Default.PortNumber : DefaultPort;
            IpAddressLabel.Text = address;
            PortLabel.Text = port;
            _baseAddress = string.Format(_baseAddress, address, port);

            Generate.Content = "Generate & Copy URL";
        }
开发者ID:jamesqo,项目名称:YouCast,代码行数:33,代码来源:MainWindow.xaml.cs

示例9: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            this.IsPostPanelExpand = true;
            this.IsFunctionPanelExpand = true;
            this.IsMessagePostPanelExpand = true;

            this.AuthPanel.OkButton.Click += new RoutedEventHandler(OkButton_Click);
            this.AuthPanel.PrevButton.Click += new RoutedEventHandler(PrevButton_Click);
            this.AuthPanel.NextButton.Click += new RoutedEventHandler(NextButton_Click);

            this.ReplyPanel.ReplyButton.Click += new RoutedEventHandler(ReplyPanelReplyButton_Click);
            this.ReplyPanel.CancelButton.Click += new RoutedEventHandler(ReplyPanelCancelButton_Click);

            #region Task Tray
            int ScreenWidth = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width;
            int Screenheigth = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height;
            int AppWidth = (int)this.Width;
            int AppHeight = (int)this.Height;
            Canvas.SetLeft(this, ScreenWidth - AppWidth);  //ScreenWidth / 2 - AppWidth / 2;
            Canvas.SetTop(this, Screenheigth - AppHeight); //Screenheigth / 2 - AppHeight / 2;
            this.StateChanged += new EventHandler(MainWindow_StateChanged);
            this.taskIcon = new System.Windows.Forms.NotifyIcon();
            this.taskIcon.Visible = true;
            this.taskIcon.Icon = Properties.Resources.YammyyIcon;
            this.taskIcon.MouseClick += new System.Windows.Forms.MouseEventHandler(taskIcon_MouseClick);
            this.taskIcon.ContextMenu = new System.Windows.Forms.ContextMenu();
            System.Windows.Forms.MenuItem item = new System.Windows.Forms.MenuItem("&Exit", taskIconItemExit_Click);
            this.taskIcon.ContextMenu.MenuItems.Add(item);
            #endregion

            System.Threading.Thread th = new System.Threading.Thread(new System.Threading.ThreadStart(InitialCheck));
            th.Start();
        }
开发者ID:changman,项目名称:yammyy,代码行数:35,代码来源:MainWindow.xaml.cs

示例10: LogAndErrorsUtils

 public LogAndErrorsUtils(System.Windows.Forms.NotifyIcon notifyIcon, System.Windows.Forms.ToolTipIcon tooltypeIcon)
 {
     m_logger = LogManager.GetCurrentClassLogger();
     m_notifyIcon = notifyIcon;
     m_tooltypeIcon = tooltypeIcon;
     m_bFirstError = false;
 }
开发者ID:ignazio-castrogiovanni,项目名称:OCR_AD,代码行数:7,代码来源:LogAndErrorsUtils.cs

示例11: Main

        public Main()
        {
            InitializeComponent();
            if (isDebug.Equals("false"))
                this.Topmost = true;

            this.notifyIcon = new System.Windows.Forms.NotifyIcon();
            this.notifyIcon.BalloonTipText = "多电站演示系统正在运行!";
            this.notifyIcon.Text = "多电站演示系统!";
            this.notifyIcon.Icon = new System.Drawing.Icon("favicon.ico");
            this.notifyIcon.Visible = true;
            this.notifyIcon.ShowBalloonTip(1000);
            this.notifyIcon.MouseClick += new System.Windows.Forms.MouseEventHandler(notifyIcon_MouseClick);

            System.Windows.Forms.MenuItem showWindow = new System.Windows.Forms.MenuItem("显示界面");
            showWindow.Click += new EventHandler(showWindow_Click);

            System.Windows.Forms.MenuItem exitSystem = new System.Windows.Forms.MenuItem("退出");
            exitSystem.Click += new EventHandler(exitSystem_Click);
            System.Windows.Forms.MenuItem[] menuItems = new System.Windows.Forms.MenuItem[] { showWindow, exitSystem };
            this.notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu(menuItems);

            this.StateChanged += new EventHandler(MainWindow_StateChanged);

            setHook();

            autoRun();
            //GC.Collect();
            //GC.WaitForPendingFinalizers();
            //GC.Collect();
        }
开发者ID:dalinhuang,项目名称:loosoft,代码行数:31,代码来源:Main.xaml.cs

示例12: Init

        void Init()
        {
            this.notifyIcon = new System.Windows.Forms.NotifyIcon();
            //this.notifyIcon.BalloonTipText = "你好, 欢迎使用随身袋!";
            this.notifyIcon.Text = window.Title;
            this.notifyIcon.Icon = System.Drawing.Icon.ExtractAssociatedIcon(System.IO.Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase, AppDomain.CurrentDomain.SetupInformation.ApplicationName));
            this.notifyIcon.Visible = true;
            this.notifyIcon.DoubleClick += new EventHandler(delegate
            {
                if (window.Top < 0) { window.Top = 1; }
                window.Topmost = true;
                window.Show();
                window.WindowState = wsl;

            });

            this.notifyIcon.ContextMenu = new System.Windows.Forms.ContextMenu();
            AddMenuItem("打开随身袋", delegate
            {
                if (window.Top < 0) { window.Top = 1; }
                window.Topmost = true;
                window.Show();
                window.WindowState = wsl;
            });
            this.notifyIcon.ContextMenu.MenuItems.Add("-");
            AddMenuItem("退出",delegate { IsCanClose = true; window.Close(); });
            //this.notifyIcon.ShowBalloonTip(1000);
        }
开发者ID:zecak,项目名称:CarryBag,代码行数:28,代码来源:WindowSysMin.cs

示例13: MainWindow

        public MainWindow()
        {
            InitializeComponent();
            TasktrayIcon = new NotifyIcon
            {
                Text = "Kbtter",
                Visible = true,
                Icon = new Icon("trayicon.ico")
            };

            Player = new MediaPlayer();

            UploadImagePath = new Dictionary<string, Stream>();
            UploadImageDialog = new OpenFileDialog();
            UploadImageDialog.AddExtension = true;
            UploadImageDialog.Multiselect = true;
            UploadImageDialog.Title = "アップロードする画像を選択";
            UploadImageDialog.Filter = "対応している画像ファイル|*.png;*.jpg;*.jpeg;*.gif|PNGイメージ|*.png|JPEGイメージ|*.jpg;*.jpeg|GIFイメージ|*.gif";

            IronPythonEngine = Python.CreateEngine();
            IronPythonEngine.Runtime.LoadAssembly(this.GetType().Assembly);
            IronPythonEngine.Runtime.LoadAssembly(Assembly.LoadFrom("TweetSharp.dll"));

            TweetPlugins = new List<IKbtterOnTweet>();
            RetweetPlugins = new List<IKbtterOnRetweet>();
            FavoritePlugins = new List<IKbtterOnFavorite>();
            UnfavoritePlugins = new List<IKbtterOnUnfavorite>();
            InitializePlugins = new List<IKbtterOnInitialize>();
            WindowPlugins = new List<IKbtterCallable>();

            Settings = new Config();
        }
开发者ID:kb10uy,项目名称:Kbtter,代码行数:32,代码来源:MainWindow.Logic.cs

示例14: InitializeBackend

        public void InitializeBackend(object frontend)
        {
            statusIcon = new System.Windows.Forms.NotifyIcon ();

            //TODO: expose Visible property in the StatusIcon class
            statusIcon.Visible = true;
        }
开发者ID:7digital,项目名称:xwt,代码行数:7,代码来源:StatusIconBackend.cs

示例15: Window1

        public Window1()
        {
            InitializeComponent();

            _systemtray = new System.Windows.Forms.NotifyIcon();

            Assembly a = Assembly.GetExecutingAssembly();
            Stream logoStream = a.GetManifestResourceStream("YAWAMT.SystemTrayClient.yawamt.ico");

            _systemtray.Icon = new System.Drawing.Icon(logoStream);
            _systemtray.Visible = true;

            _systemtray.Click += new EventHandler(SystemTrayIcon_Click);
            _systemtray.MouseMove += new System.Windows.Forms.MouseEventHandler(SystemTrayIcon_MouseMove);
            _systemtray.BalloonTipShown += new EventHandler(SystemTrayIcon_BalloonTipShown);
            _systemtray.BalloonTipClosed += new EventHandler(SystemTrayIcon_BalloonTipClosed);

            _systemtray.BalloonTipIcon = System.Windows.Forms.ToolTipIcon.Info;
            _systemtray.BalloonTipTitle = "yawamt";
            _systemtray.BalloonTipText = "3 down, 5 up";

            AttachContextMenu();

            try
            {
                IconBitmapDecoder decoder = new IconBitmapDecoder(logoStream, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
                imglogo.Source = decoder.Frames[0];
            }
            catch { }

            this.Hide();

            //if (string.IsNullOrEmpty(YAWAMT.SystemTrayClient.Properties.Settings.Default.Url))
            //    ContextMenuSettings(this, EventArgs.Empty);
        }
开发者ID:overeemm,项目名称:yawamt,代码行数:35,代码来源:Window1.xaml.cs


注:本文中的System.Windows.Forms.NotifyIcon类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。