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

📄 tabbedoptions.cs

📁 c#精彩编程百例(源代码)
💻 CS
字号:
//  TabbedOptions.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.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Xml;

using SharpDevelop.Gui.Dialogs.OptionPanels;
using SharpDevelop.Internal.Project;
using SharpDevelop.Internal.Text;
using SharpDevelop.Tool.Data;

namespace SharpDevelop.Gui.Dialogs {
	
	public interface ISdOptionDialog
	{
		void AddOptionPanel(AbstractOptionPanel panel);
	}
	
	/// <summary>
	/// Basic "tabbed" options dialog
	/// </summary>
    public class TabbedOptions : System.Windows.Forms.Form,  ISdOptionDialog
    {
		private System.ComponentModel.Container components;
		private System.Windows.Forms.Button cancelButton;
		private System.Windows.Forms.Button okButton;
		private System.Windows.Forms.TabControl tabControl1;
		
        ArrayList OptionPanels = new ArrayList();
		
		void AcceptEvent(object sender, EventArgs e)
		{
			foreach (AbstractOptionPanel pane in OptionPanels)
				pane.Accept();
		}
		
		public void AddOptionPanel(AbstractOptionPanel panel)
		{
			OptionPanels.Add(panel);
			TabPage page = new TabPage();
			page.Text = panel.PanelName;
			page.Controls.Add(panel);
			panel.Dock = DockStyle.Fill;
			tabControl1.TabPages.Add(page);
		}
		
		public TabbedOptions(MainWindow window)
		{
			InitializeComponent();
			
			okButton.Click += new EventHandler(AcceptEvent);
			MaximizeBox  = MinimizeBox = false;
			ShowInTaskbar = false;
			StartPosition = FormStartPosition.CenterParent;
			Owner = window;
			Icon = null;
		}

		public override void Dispose()
		{
			base.Dispose();
			foreach (TabPage p in tabControl1.TabPages)
				p.Dispose();
			components.Dispose();
		}
		
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.okButton = new System.Windows.Forms.Button();
			this.cancelButton = new System.Windows.Forms.Button();
			this.tabControl1 = new System.Windows.Forms.TabControl();
			
			okButton.Location = new System.Drawing.Point(250 - 8, 308);
			okButton.Size = new System.Drawing.Size(74, 23);
			okButton.TabIndex = 1;
			okButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | AnchorStyles.Right;
			okButton.Text = Resource.GetString("Global.OKButtonText");
			okButton.DialogResult = DialogResult.OK;
			
			cancelButton.Location = new System.Drawing.Point(332 - 8, 308);
			cancelButton.Size = new System.Drawing.Size(74, 23);
			cancelButton.TabIndex = 2;
			cancelButton.Anchor = System.Windows.Forms.AnchorStyles.Bottom | AnchorStyles.Right;
			cancelButton.Text = Resource.GetString("Global.CancelButtonText");
			cancelButton.DialogResult = DialogResult.Cancel;
			
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.Text = Resource.GetString("Dialog.Options.ProjectOptions.DialogName");
			
			this.ClientSize = new System.Drawing.Size(408, 341);
			this.FormBorderStyle = FormBorderStyle.Sizable;
			
			ControlBox  = false;
			
			tabControl1.Location = new System.Drawing.Point(8, 8);
			tabControl1.Text = "tabControl1";
			tabControl1.Size = new System.Drawing.Size(392, 296);
			tabControl1.SelectedIndex = 0;
			tabControl1.TabIndex = 0;
			tabControl1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom| AnchorStyles.Right |AnchorStyles.Left;
			
			this.Controls.Add(cancelButton);
			this.Controls.Add(okButton);
			this.Controls.Add(tabControl1);
			
		}
    }
}

⌨️ 快捷键说明

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