⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 externaltoolpanel.cs

📁 c#精彩编程百例(源代码)
💻 CS
字号:
//  ExternalToolPanel.cs
//  Copyright (C) 2000 Mike Krueger
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

using System;
using System.Collections;
using System.Windows.Forms;

using SharpDevelop.Internal.ExternalTool;
using SharpDevelop.Tool.Data;

namespace SharpDevelop.Gui.Dialogs.OptionPanels {

	public class ExternalToolPane : AbstractOptionPanel
    {
		private System.ComponentModel.Container components;
//		private System.Windows.Forms.Button helpButton;
		private System.Windows.Forms.Button removeButton;
		private System.Windows.Forms.Button addButton;
		
//		private System.Windows.Forms.Button       okButton;
//		private System.Windows.Forms.Button       cancelButton      =  new Button();
		private System.Windows.Forms.PropertyGrid toolPropertyGrid;
		private System.Windows.Forms.Label        label1;
		private System.Windows.Forms.ListBox      toolListBox;
		
	    public override  void Accept()
	    {
	    	ArrayList newlist = new ArrayList();
	    	foreach (object o in toolListBox.Items) {
				if (o != null)
					newlist.Add(o);
	    	}
	    	ToolLoader.Tool = newlist;
	    }
	    
	    void selectEvent(object sender, EventArgs e)
	    {
			toolPropertyGrid.SelectedObject = toolListBox.SelectedItem;
	    }
		
		void removeEvent(object sender, EventArgs e)
	    {
	    	if (toolListBox.SelectedIndex != -1)
				toolListBox.Items.Remove(toolListBox.SelectedIndex);
	    }
		
		void addEvent(object sender, EventArgs e)
	    {
			toolListBox.Items.Add(new ExternalTool());
	    }
	    
        public ExternalToolPane() : base(Resource.GetString("Dialog.Options.ExternalToolsText"))
        {
        	InitializeComponents();
        }
        
        /// <summary>
        ///    Clean up any resources being used
        /// </summary>
        public override void Dispose() 
        {
            base.Dispose();
            components.Dispose();
        }
	
	
        /// <summary>
        ///    Required method for Designer support - do not modify
        ///    the contents of this method with an editor
        /// </summary>
        void InitializeComponents()
		{
			this.components = new System.ComponentModel.Container();
//			this.helpButton = new System.Windows.Forms.Button();
			this.removeButton = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.addButton = new System.Windows.Forms.Button();
//			this.okButton = new System.Windows.Forms.Button();
			this.toolListBox = new System.Windows.Forms.ListBox();
			this.toolPropertyGrid = new System.Windows.Forms.PropertyGrid();
			
			removeButton.Location = new System.Drawing.Point(80, 248);
			removeButton.Size = new System.Drawing.Size(72, 24);
			removeButton.TabIndex = 6;
			removeButton.Text = Resource.GetString("Global.RemoveButtonText");
			removeButton.Anchor       = AnchorStyles.Bottom | AnchorStyles.Left;
			
			label1.Location = new System.Drawing.Point(8, 8);
			label1.Text = Resource.GetString("Dialog.Options.ExternalTool.ToolsLabel");
			
			label1.Size = new System.Drawing.Size(100, 16);
			label1.TabIndex = 1;
			
//			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			//@design this.TrayLargeIcon = true;
			//@design this.TrayHeight = 0;
			this.ClientSize = new System.Drawing.Size(368 + 60, 277);
			
			addButton.Location = new System.Drawing.Point(8, 248);
			addButton.Size = new System.Drawing.Size(64, 24);
			addButton.TabIndex = 5;
			addButton.Text = Resource.GetString("Global.AddButtonText");
			addButton.Anchor       = AnchorStyles.Bottom | AnchorStyles.Left;
			
			toolListBox.Location = new System.Drawing.Point(8, 24);
			toolListBox.Size = new System.Drawing.Size(144, 212);
			toolListBox.TabIndex = 0;
			toolListBox.Anchor       = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
			
			toolPropertyGrid.Location = new System.Drawing.Point(168, 8);
			toolPropertyGrid.Text = "PropertyGrid";
			toolPropertyGrid.LineColor = System.Drawing.SystemColors.ScrollBar;
//			toolPropertyGrid.OutlineColor = System.Drawing.SystemColors.GrayText;
//			toolPropertyGrid.TextColor = System.Drawing.SystemColors.WindowText;
			toolPropertyGrid.Size = new System.Drawing.Size(184 + 60, 232);
			toolPropertyGrid.LargeButtons = false;
//			toolPropertyGrid.ActiveDocument = null;
			toolPropertyGrid.TabIndex = 2;
			toolPropertyGrid.CommandsVisibleIfAvailable = true;
			toolPropertyGrid.Anchor       = AnchorStyles.Top | AnchorStyles.Bottom| AnchorStyles.Right |AnchorStyles.Left;
			
//			this.Controls.Add(helpButton);
			this.Controls.Add(removeButton);
			this.Controls.Add(addButton);
//			this.Controls.Add(okButton);
//			this.Controls.Add(cancelButton);
			this.Controls.Add(toolPropertyGrid);
			this.Controls.Add(label1);
			this.Controls.Add(toolListBox);
        	
            // Required for Win Form Designer support
//        	CancelButton = cancelButton;
//        	AcceptButton = okButton;
			foreach (object o in ToolLoader.Tool)
				toolListBox.Items.Add(o);
        	toolListBox.SelectedIndexChanged += new EventHandler(selectEvent);
//        	okButton.Click += new EventHandler(closeEvent);
        	removeButton.Click+=new EventHandler(removeEvent);
        	addButton.Click += new EventHandler(addEvent);
//			MaximizeBox  = MinimizeBox = false;
			
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -