コード例 #1
0
        /// <summary>
        ///     初始化宿主
        /// </summary>
        public void InitApp()
        {
            #region

            // 定义一个下拉菜单
            var menuItemName = "AnonymityPluginMenu";
            if (!MenuItems.Contains(menuItemName))
            {
                MenuItems.Add(menuItemName);
            }

            dsmi        = App.AddMenuItem(menuItemName, "验证匿名度");
            dsmi.Click += item_Click; //为下拉单添加事件

            //定义一个工具按钮
            var toolButtonName = "AnonymityPluginToolButton";
            if (!ToolButtons.Contains(toolButtonName))
            {
                ToolButtons.Add(toolButtonName);
            }

            ToolStripButton tsb = App.AddToolButton(toolButtonName, "验证匿名度");
            tsb.Click += item_Click; //为工具栏按钮添加事件
            #endregion
        }
コード例 #2
0
        /// <summary>
        ///     初始化宿主
        /// </summary>
        public void InitApp()
        {
            #region

            // 定义一个下拉菜单
            var menuItemName = "EncodePluginMenu";
            if (!MenuItems.Contains(menuItemName))
            {
                MenuItems.Add(menuItemName);
            }

            dsmi         = new ToolStripMenuItem();
            dsmi.Text    = "加密解密";
            dsmi.Name    = menuItemName;
            dsmi.Visible = true;
            dsmi.Click  += item_Click;              //为下拉单添加时间
            App.PluginMenu.DropDownItems.Add(dsmi); //在宿主程序中添加菜单

            //定义一个工具按钮
            var toolButtonName = "EncodePluginToolButton";
            if (!ToolButtons.Contains(toolButtonName))
            {
                ToolButtons.Add(toolButtonName);
            }

            var tsb = new ToolStripButton();
            tsb.Name         = toolButtonName;
            tsb.Text         = "加密解密";
            tsb.ToolTipText  = tsb.Text;
            tsb.DisplayStyle = ToolStripItemDisplayStyle.Image;
            tsb.Image        = Resources._lock;
            tsb.Click       += item_Click;
            App.Toolbar.Items.Add(tsb);

            #endregion
        }