ScreenToGif/Controls/TrayIcon.cs

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Windows.Forms;

namespace ScreenToGif.Controls
{
    /// <summary>
    /// Wraps a WinForm NotifyIcon and adds a ScreenToGif logo to it.
    /// </summary>
    internal class TrayIcon : IDisposable
    {
        #region Member variables

        public EventHandler NotifyIconClicked;

        private readonly NotifyIcon _notifyIcon = new NotifyIcon();

        #endregion Member variables

        #region Constructor

        public TrayIcon()
        {
            //_notifyIcon.Icon = Resources.Logo;
            _notifyIcon.Click += OnNotifyIconClicked;
            _notifyIcon.Visible = false;
        }

        #endregion Constructor

        #region Public methods

        public void ShowTrayIcon()
        {
            _notifyIcon.Visible = true;
        }

        public void HideTrayIcon()
        {
            _notifyIcon.Visible = false;
        }

        #endregion Public methods

        #region Private methods

        private void OnNotifyIconClicked(object sender, EventArgs e)
        {
            if (null != NotifyIconClicked)
            {
                NotifyIconClicked(this, new EventArgs());
            }
        }

        #endregion Private methods

        public void Dispose()
        {
            _notifyIcon.Dispose();
        }
    }
后面还有 1 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。