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


C# System.ComponentModel.IContainer.Add方法代码示例

本文整理汇总了C#中System.ComponentModel.IContainer.Add方法的典型用法代码示例。如果您正苦于以下问题:C# System.ComponentModel.IContainer.Add方法的具体用法?C# System.ComponentModel.IContainer.Add怎么用?C# System.ComponentModel.IContainer.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.ComponentModel.IContainer的用法示例。


在下文中一共展示了System.ComponentModel.IContainer.Add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: NotifyIcon

        public NotifyIcon(Main m)
        {
            this.m = m;

            components = new System.ComponentModel.Container();
            menu = new ContextMenuStrip();
            exit = new ToolStripMenuItem();
            settings = new ToolStripMenuItem();
            help = new ToolStripMenuItem();
            tobase64 = new ToolStripMenuItem();
            tolink = new ToolStripMenuItem();

            exit.Text = "Quitter";
            exit.Image = ScreenShot.Properties.Resources.close.ToBitmap();
            exit.BackColor = c;
            exit.Click += (ob, ev) =>
            {
                m.Close();
            };

            help.Text = "Aide";
            help.Image = ScreenShot.Properties.Resources.help.ToBitmap();
            help.BackColor = c;
            help.Click += (ob, ev) =>
            {
                Alert(("-" + CONFIG.XML.PRINT_SCREEN.Key + "+" + CONFIG.XML.PRINT_SCREEN.Modifiers + " : Transforme en lien l'écran actif.\n" +
                      "-" + CONFIG.XML.PRINT_WINDOW.Key + "+" + CONFIG.XML.PRINT_WINDOW.Modifiers + " : Transforme en lien la fenêtre active.\n" +
                      "-" + CONFIG.XML.PRINT_FILE.Key + "+" + CONFIG.XML.PRINT_FILE.Modifiers + " : Transforme en lien le presse-papier.\n" +
                      "-" + CONFIG.XML.PRINT_CROP.Key + "+" + CONFIG.XML.PRINT_CROP.Modifiers + " : Ouvre la fenêtre de découpage.\n")
                      .Replace("Control", "Ctrl").Replace("+None", ""), "Raccourcis", ToolTipIcon.Info, 20000);
            };

            settings.Text = "Options";
            settings.Image = ScreenShot.Properties.Resources.settings.ToBitmap();
            settings.BackColor = c;
            settings.Click += (ob, ev) =>
            {
                if (op == null || op.IsDisposed)
                {
                    op = new Options(m);
                    op.ShowDialog();
                    op.Dispose();
                }
            };

            tobase64.Text = "Transformer en texte";
            tobase64.Image = ScreenShot.Properties.Resources.tobase64.ToBitmap();
            tobase64.BackColor = c;
            tobase64.Click += (ob, ev) =>
            {
                m.GetBase64();
            };

            tolink.Text = "Tranformer en lien";
            tolink.Image = ScreenShot.Properties.Resources.tolink.ToBitmap();
            tolink.BackColor = c;
            tolink.Click += (ob, ev) =>
            {
                m.Load_Clipboard();
            };

            menu.Items.Add(tolink);
            menu.Items.Add(tobase64);
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(settings);
            menu.Items.Add(help);
            menu.Items.Add(new ToolStripSeparator());
            menu.Items.Add(exit);

            components.Add(menu);
            nIcon = new System.Windows.Forms.NotifyIcon(components);

            nIcon.Icon = ScreenShot.Properties.Resources.connection;
            nIcon.Text = "Connexion au serveur..";

            nIcon.ContextMenuStrip = menu;

            nIcon.Visible = true;

            nIcon.MouseDoubleClick += (ob, ev) =>
            {
                settings.PerformClick();
            };
        }
开发者ID:KptCheeseWhiz,项目名称:ScreenShot,代码行数:84,代码来源:NotifyIcon.cs


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