Click here to Skip to main content
15,893,622 members
Articles / Programming Languages / C#

Plug-ins in C#

Rate me:
Please Sign up or sign in to vote.
4.84/5 (169 votes)
4 Mar 200410 min read 569.1K   13.8K   437  
Give your application Plug-in functionlity!
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace Host
{
	/// <summary>
	/// Summary description for frmFeedback.
	/// </summary>
	public class frmFeedback : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button butOk;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.Label lblPluginAuthor;
		private System.Windows.Forms.Label lblPluginVersion;
		private System.Windows.Forms.Label lblPluginName;
		private System.Windows.Forms.Label lblPluginDesc;
		private System.Windows.Forms.Label lblFeedback;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public frmFeedback()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.butOk = new System.Windows.Forms.Button();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.lblPluginDesc = new System.Windows.Forms.Label();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.lblPluginAuthor = new System.Windows.Forms.Label();
			this.lblPluginVersion = new System.Windows.Forms.Label();
			this.lblPluginName = new System.Windows.Forms.Label();
			this.lblFeedback = new System.Windows.Forms.Label();
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.SuspendLayout();
			// 
			// butOk
			// 
			this.butOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
			this.butOk.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.butOk.Location = new System.Drawing.Point(128, 200);
			this.butOk.Name = "butOk";
			this.butOk.Size = new System.Drawing.Size(64, 24);
			this.butOk.TabIndex = 0;
			this.butOk.Text = "&OK";
			this.butOk.Click += new System.EventHandler(this.butOk_Click);
			// 
			// groupBox1
			// 
			this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.groupBox1.Controls.Add(this.lblFeedback);
			this.groupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.groupBox1.Location = new System.Drawing.Point(8, 120);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(312, 72);
			this.groupBox1.TabIndex = 1;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Feedback:";
			// 
			// lblPluginDesc
			// 
			this.lblPluginDesc.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.lblPluginDesc.Location = new System.Drawing.Point(16, 72);
			this.lblPluginDesc.Name = "lblPluginDesc";
			this.lblPluginDesc.Size = new System.Drawing.Size(288, 32);
			this.lblPluginDesc.TabIndex = 0;
			// 
			// groupBox2
			// 
			this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.groupBox2.Controls.Add(this.lblPluginAuthor);
			this.groupBox2.Controls.Add(this.lblPluginVersion);
			this.groupBox2.Controls.Add(this.lblPluginName);
			this.groupBox2.Controls.Add(this.lblPluginDesc);
			this.groupBox2.FlatStyle = System.Windows.Forms.FlatStyle.System;
			this.groupBox2.Location = new System.Drawing.Point(8, 8);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(312, 112);
			this.groupBox2.TabIndex = 2;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "Plugin Info:";
			// 
			// lblPluginAuthor
			// 
			this.lblPluginAuthor.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.lblPluginAuthor.Location = new System.Drawing.Point(8, 48);
			this.lblPluginAuthor.Name = "lblPluginAuthor";
			this.lblPluginAuthor.Size = new System.Drawing.Size(296, 16);
			this.lblPluginAuthor.TabIndex = 5;
			this.lblPluginAuthor.Text = "By: <Author\'s Name>";
			// 
			// lblPluginVersion
			// 
			this.lblPluginVersion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.lblPluginVersion.Location = new System.Drawing.Point(8, 32);
			this.lblPluginVersion.Name = "lblPluginVersion";
			this.lblPluginVersion.Size = new System.Drawing.Size(296, 16);
			this.lblPluginVersion.TabIndex = 4;
			this.lblPluginVersion.Text = "(<Version>)";
			// 
			// lblPluginName
			// 
			this.lblPluginName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.lblPluginName.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.lblPluginName.Location = new System.Drawing.Point(8, 16);
			this.lblPluginName.Name = "lblPluginName";
			this.lblPluginName.Size = new System.Drawing.Size(296, 16);
			this.lblPluginName.TabIndex = 3;
			this.lblPluginName.Text = "<Plugin Name Here>";
			// 
			// lblFeedback
			// 
			this.lblFeedback.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.lblFeedback.Location = new System.Drawing.Point(8, 16);
			this.lblFeedback.Name = "lblFeedback";
			this.lblFeedback.Size = new System.Drawing.Size(296, 48);
			this.lblFeedback.TabIndex = 0;
			// 
			// frmFeedback
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(328, 230);
			this.Controls.Add(this.groupBox2);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.butOk);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "frmFeedback";
			this.Text = "Plugin Feedback:";
			this.Load += new System.EventHandler(this.frmFeedback_Load);
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void frmFeedback_Load(object sender, System.EventArgs e)
		{
		
		}

		private void butOk_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}

		public string PluginAuthor
		{
			get {return this.lblPluginAuthor.Text;}
			set {this.lblPluginAuthor.Text = value;}
		}

		public string PluginDesc
		{
			get {return this.lblPluginDesc.Text;}
			set {this.lblPluginDesc.Text = value;}
		}

		public string PluginName
		{			
			get {return this.lblPluginName.Text;}
			set {this.lblPluginName.Text = value;}
		}
		public string PluginVersion
		{
			get {return this.lblPluginVersion.Text;}
			set {this.lblPluginVersion.Text = value;}
		}
		public string Feedback
		{
			get {return this.lblFeedback.Text;}
			set {this.lblFeedback.Text = value;}
		}
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Canada Canada
Currently I'm an Oracle DBA for a School Board, having recently completed my undergrad at the University of Guelph with a Bachelor of Computing.

I obviously enjoy programming Smile | :)

Contact Me:
(MSN: jondick at gmail dot com)
(IRC: Dalnet: #c#, #asp.net, #vb.net)
(IRC: FreeNode: #linuxpeople)

Comments and Discussions