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

📄 edittemplatedialog.cs

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

using SharpDevelop.Gui;
using SharpDevelop.Internal.Templates;
using SharpDevelop.Tool.Data;

namespace SharpDevelop.Gui.Dialogs {
	
	public class EditTemplateDialog : Form 
	{
		
		private System.ComponentModel.Container components;
		private Button cancelButton;
		private Button button1;
		private TextBox descriptionTextBox;
		private Label label2;
		private TextBox ShortCutTextBox;
		private Label label1;
		CodeTemplate t;
		
	    void CloseEvent(object sender, EventArgs e)
	    {
	    	t.Shortcut    = ShortCutTextBox.Text;
	    	t.Description = descriptionTextBox.Text;
	    }
		
		public EditTemplateDialog(CodeTemplate t) {
			
			this.t = t;
			// Required for Win Form Designer support
			InitializeComponent();
			
			ShortCutTextBox.Text = t.Shortcut;
			descriptionTextBox.Text = t.Description;
			AcceptButton = button1;
			CancelButton = cancelButton;
        	button1.Click += new EventHandler(CloseEvent);
			TopMost = true;
			ShortCutTextBox.Select();
			StartPosition = FormStartPosition.CenterParent;
			MaximizeBox  = MinimizeBox = false;
			ShowInTaskbar = false;
			Icon = null;
			StartPosition = FormStartPosition.CenterParent;
			
		}
		
		/// <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>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			this.button1 = new Button();
			this.label1 = new Label();
			this.label2 = new Label();
			this.ShortCutTextBox = new TextBox();
			this.descriptionTextBox = new TextBox();
			this.cancelButton = new Button();
			
			button1.Location = new System.Drawing.Point(124, 72);
			button1.Size = new System.Drawing.Size(74, 24);
			button1.TabIndex = 4;
			button1.Text = Resource.GetString("Global.OKButtonText");
			
			label1.Location = new System.Drawing.Point(8, 11);
			label1.Text = Resource.GetString("Dialog.Options.CodeTemplate.Template");
			label1.Size = new System.Drawing.Size(74, 16);
			label1.TabIndex = 0;
			
			label2.Location = new System.Drawing.Point(8, 43);
			label2.Text = Resource.GetString("Dialog.Options.CodeTemplate.Description");
			label2.Size = new System.Drawing.Size(74, 16);
			label2.TabIndex = 2;
			
			ShortCutTextBox.Location = new System.Drawing.Point(80, 8);
			ShortCutTextBox.Text = "";
			ShortCutTextBox.TabIndex = 1;
			ShortCutTextBox.Size = new System.Drawing.Size(200, 20);
			
			descriptionTextBox.Location = new System.Drawing.Point(80, 40);
			descriptionTextBox.Text = "";
			descriptionTextBox.TabIndex = 3;
			descriptionTextBox.Size = new System.Drawing.Size(200, 20);
			
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.Text = "Edit Template";
			//@design this.TrayLargeIcon = true;
			this.FormBorderStyle = FormBorderStyle.FixedDialog;
			//@design this.TrayHeight = 0;
			this.ClientSize = new System.Drawing.Size(290, 103);
			
			cancelButton.Location = new System.Drawing.Point(206, 72);
			cancelButton.Size = new System.Drawing.Size(74, 24);
			cancelButton.TabIndex = 5;
			cancelButton.Text = Resource.GetString("Global.CancelButtonText");
			button1.DialogResult = DialogResult.OK;
			cancelButton.DialogResult = DialogResult.Cancel;
			
			this.Controls.Add(cancelButton);
			this.Controls.Add(button1);
			this.Controls.Add(descriptionTextBox);
			this.Controls.Add(label2);
			this.Controls.Add(ShortCutTextBox);
			this.Controls.Add(label1);
		}
	}
}

⌨️ 快捷键说明

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