RegionMaster Controls

The RegionMaster Controls allow users to create non-rectangular, discontiguous top level windows without writing any code in the Visual Studio .NET form designer.

C# (360.1 KB)
 
 
 
 
 
4 Star
(1)
2,647 times
Add to favorites
2/2/2011
E-mail Twitter del.icio.us Digg Facebook

Solution explorer

C#
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace TestApp
{
	/// <summary>
	/// Summary description for Form2.
	/// </summary>
	public class Form2 : System.Windows.Forms.Form
	{
		private Microsoft.Samples.CurvedPanel curvedPanel1;
		private Microsoft.Samples.CurvedPanel curvedPanel2;
		private System.Windows.Forms.Label label1;
		private Microsoft.Samples.CurvedPanel curvedPanel3;
		private System.Windows.Forms.Label label2;
		private Microsoft.Samples.CurvedPanel curvedPanel4;
		private System.Windows.Forms.LinkLabel linkLabel1;
		private System.Windows.Forms.LinkLabel linkLabel2;
		private System.Windows.Forms.LinkLabel linkLabel3;
		private Microsoft.Samples.BounceButton bounceButton1;
		private Microsoft.Samples.BounceButton bounceButton2;
		private System.Windows.Forms.Label label3;
		private Microsoft.Samples.CurvedPanel curvedPanel5;
		private System.Windows.Forms.Label label4;
		private Microsoft.Samples.CurvedPanel curvedPanel6;
		private Microsoft.Samples.BounceButton bounceButton3;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label6;
		private Microsoft.Samples.RegionBuilder regionBuilder1;
		private System.ComponentModel.IContainer components;

		public Form2()
		{
			//
			// 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.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form2));
			this.curvedPanel1 = new Microsoft.Samples.CurvedPanel();
			this.linkLabel3 = new System.Windows.Forms.LinkLabel();
			this.linkLabel2 = new System.Windows.Forms.LinkLabel();
			this.linkLabel1 = new System.Windows.Forms.LinkLabel();
			this.curvedPanel2 = new Microsoft.Samples.CurvedPanel();
			this.label1 = new System.Windows.Forms.Label();
			this.curvedPanel3 = new Microsoft.Samples.CurvedPanel();
			this.label2 = new System.Windows.Forms.Label();
			this.curvedPanel4 = new Microsoft.Samples.CurvedPanel();
			this.label5 = new System.Windows.Forms.Label();
			this.bounceButton3 = new Microsoft.Samples.BounceButton();
			this.label3 = new System.Windows.Forms.Label();
			this.bounceButton1 = new Microsoft.Samples.BounceButton();
			this.bounceButton2 = new Microsoft.Samples.BounceButton();
			this.label6 = new System.Windows.Forms.Label();
			this.curvedPanel5 = new Microsoft.Samples.CurvedPanel();
			this.label4 = new System.Windows.Forms.Label();
			this.curvedPanel6 = new Microsoft.Samples.CurvedPanel();
			this.regionBuilder1 = new Microsoft.Samples.RegionBuilder(this.components);
			this.curvedPanel1.SuspendLayout();
			this.curvedPanel2.SuspendLayout();
			this.curvedPanel3.SuspendLayout();
			this.curvedPanel4.SuspendLayout();
			this.curvedPanel5.SuspendLayout();
			this.curvedPanel6.SuspendLayout();
			this.SuspendLayout();
			// 
			// curvedPanel1
			// 
			this.curvedPanel1.AddToFormRegion = true;
			this.curvedPanel1.BackColor = System.Drawing.Color.Transparent;
			this.curvedPanel1.BottomMargin = 0;
			this.curvedPanel1.Controls.AddRange(new System.Windows.Forms.Control[] {
																					   this.linkLabel3,
																					   this.linkLabel2,
																					   this.linkLabel1,
																					   this.curvedPanel2});
			this.curvedPanel1.FillColor = System.Drawing.SystemColors.Window;
			this.curvedPanel1.FillTransparency = 1;
			this.curvedPanel1.FormBehavior = Microsoft.Samples.FormBehaviors.None;
			this.curvedPanel1.LeftMargin = 0;
			this.curvedPanel1.LineThickness = 2;
			this.curvedPanel1.Location = new System.Drawing.Point(14, 16);
			this.curvedPanel1.LowerLeftCornerRadius = 1;
			this.curvedPanel1.LowerLeftCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel1.LowerRightCornerRadius = 1;
			this.curvedPanel1.LowerRightCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel1.Name = "curvedPanel1";
			this.curvedPanel1.RightMargin = 0;
			this.curvedPanel1.Size = new System.Drawing.Size(160, 112);
			this.curvedPanel1.TabIndex = 0;
			this.curvedPanel1.Text = "curvedPanel1";
			this.curvedPanel1.TopMargin = 0;
			this.curvedPanel1.UpperLeftCornerRadius = 1;
			this.curvedPanel1.UpperLeftCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel1.UpperRightCornerRadius = 26;
			this.curvedPanel1.UpperRightCornerType = Microsoft.Samples.CornerTypes.Curve;
			// 
			// linkLabel3
			// 
			this.linkLabel3.Location = new System.Drawing.Point(16, 82);
			this.linkLabel3.Name = "linkLabel3";
			this.linkLabel3.Size = new System.Drawing.Size(112, 23);
			this.linkLabel3.TabIndex = 2;
			this.linkLabel3.TabStop = true;
			this.linkLabel3.Text = "Do some other thing";
			// 
			// linkLabel2
			// 
			this.linkLabel2.Location = new System.Drawing.Point(16, 58);
			this.linkLabel2.Name = "linkLabel2";
			this.linkLabel2.TabIndex = 1;
			this.linkLabel2.TabStop = true;
			this.linkLabel2.Text = "Do something else";
			// 
			// linkLabel1
			// 
			this.linkLabel1.Location = new System.Drawing.Point(16, 34);
			this.linkLabel1.Name = "linkLabel1";
			this.linkLabel1.TabIndex = 0;
			this.linkLabel1.TabStop = true;
			this.linkLabel1.Text = "Do something";
			// 
			// curvedPanel2
			// 
			this.curvedPanel2.AddToFormRegion = true;
			this.curvedPanel2.BackColor = System.Drawing.Color.Transparent;
			this.curvedPanel2.BottomMargin = -1;
			this.curvedPanel2.Controls.AddRange(new System.Windows.Forms.Control[] {
																					   this.label1});
			this.curvedPanel2.FillColor = System.Drawing.SystemColors.ControlDark;
			this.curvedPanel2.FillTransparency = 1;
			this.curvedPanel2.FormBehavior = Microsoft.Samples.FormBehaviors.Drag;
			this.curvedPanel2.LeftMargin = -1;
			this.curvedPanel2.LineThickness = 0;
			this.curvedPanel2.Location = new System.Drawing.Point(3, 3);
			this.curvedPanel2.LowerLeftCornerRadius = 1;
			this.curvedPanel2.LowerLeftCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel2.LowerRightCornerRadius = 1;
			this.curvedPanel2.LowerRightCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel2.Name = "curvedPanel2";
			this.curvedPanel2.RightMargin = -1;
			this.curvedPanel2.Size = new System.Drawing.Size(154, 24);
			this.curvedPanel2.TabIndex = 1;
			this.curvedPanel2.Text = "curvedPanel2";
			this.curvedPanel2.TopMargin = -1;
			this.curvedPanel2.UpperLeftCornerRadius = 1;
			this.curvedPanel2.UpperLeftCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel2.UpperRightCornerType = Microsoft.Samples.CornerTypes.Curve;
			// 
			// label1
			// 
			this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label1.Location = new System.Drawing.Point(8, 5);
			this.label1.Name = "label1";
			this.label1.TabIndex = 0;
			this.label1.Text = "Area One";
			// 
			// curvedPanel3
			// 
			this.curvedPanel3.AddToFormRegion = true;
			this.curvedPanel3.BackColor = System.Drawing.Color.Transparent;
			this.curvedPanel3.BottomMargin = -1;
			this.curvedPanel3.Controls.AddRange(new System.Windows.Forms.Control[] {
																					   this.label2});
			this.curvedPanel3.FillColor = System.Drawing.SystemColors.ControlDark;
			this.curvedPanel3.FillTransparency = 1;
			this.curvedPanel3.FormBehavior = Microsoft.Samples.FormBehaviors.None;
			this.curvedPanel3.LeftMargin = -1;
			this.curvedPanel3.LineThickness = 0;
			this.curvedPanel3.Location = new System.Drawing.Point(3, 3);
			this.curvedPanel3.LowerLeftCornerRadius = 1;
			this.curvedPanel3.LowerLeftCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel3.LowerRightCornerRadius = 1;
			this.curvedPanel3.LowerRightCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel3.Name = "curvedPanel3";
			this.curvedPanel3.RightMargin = -1;
			this.curvedPanel3.Size = new System.Drawing.Size(154, 24);
			this.curvedPanel3.TabIndex = 3;
			this.curvedPanel3.Text = "curvedPanel3";
			this.curvedPanel3.TopMargin = -1;
			this.curvedPanel3.UpperLeftCornerRadius = 1;
			this.curvedPanel3.UpperLeftCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel3.UpperRightCornerType = Microsoft.Samples.CornerTypes.Curve;
			// 
			// label2
			// 
			this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label2.Location = new System.Drawing.Point(8, 5);
			this.label2.Name = "label2";
			this.label2.TabIndex = 0;
			this.label2.Text = "Area Two";
			// 
			// curvedPanel4
			// 
			this.curvedPanel4.AddToFormRegion = true;
			this.curvedPanel4.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left);
			this.curvedPanel4.BackColor = System.Drawing.Color.Transparent;
			this.curvedPanel4.BottomMargin = 0;
			this.curvedPanel4.Controls.AddRange(new System.Windows.Forms.Control[] {
																					   this.label5,
																					   this.bounceButton3,
																					   this.label3,
																					   this.bounceButton1,
																					   this.bounceButton2,
																					   this.label6,
																					   this.curvedPanel3});
			this.curvedPanel4.FillColor = System.Drawing.SystemColors.Window;
			this.curvedPanel4.FillTransparency = 1;
			this.curvedPanel4.FormBehavior = Microsoft.Samples.FormBehaviors.None;
			this.curvedPanel4.LeftMargin = 0;
			this.curvedPanel4.LineThickness = 2;
			this.curvedPanel4.Location = new System.Drawing.Point(14, 152);
			this.curvedPanel4.LowerLeftCornerRadius = 1;
			this.curvedPanel4.LowerLeftCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel4.LowerRightCornerRadius = 1;
			this.curvedPanel4.LowerRightCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel4.Name = "curvedPanel4";
			this.curvedPanel4.RightMargin = 0;
			this.curvedPanel4.Size = new System.Drawing.Size(160, 336);
			this.curvedPanel4.TabIndex = 2;
			this.curvedPanel4.Text = "curvedPanel4";
			this.curvedPanel4.TopMargin = 0;
			this.curvedPanel4.UpperLeftCornerRadius = 1;
			this.curvedPanel4.UpperLeftCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel4.UpperRightCornerRadius = 26;
			this.curvedPanel4.UpperRightCornerType = Microsoft.Samples.CornerTypes.Curve;
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(56, 200);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(56, 23);
			this.label5.TabIndex = 7;
			this.label5.Text = "Sounds";
			// 
			// bounceButton3
			// 
			this.bounceButton3.BackColor = System.Drawing.Color.Transparent;
			this.bounceButton3.DialogResult = System.Windows.Forms.DialogResult.None;
			this.bounceButton3.Image = ((System.Drawing.Bitmap)(resources.GetObject("bounceButton3.Image")));
			this.bounceButton3.Location = new System.Drawing.Point(40, 136);
			this.bounceButton3.Name = "bounceButton3";
			this.bounceButton3.Size = new System.Drawing.Size(72, 64);
			this.bounceButton3.TabIndex = 0;
			this.bounceButton3.Text = "bounceButton3";
			this.bounceButton3.Click += new System.EventHandler(this.bounceButton3_Click);
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(48, 296);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(56, 23);
			this.label3.TabIndex = 6;
			this.label3.Text = "Properties";
			// 
			// bounceButton1
			// 
			this.bounceButton1.BackColor = System.Drawing.Color.Transparent;
			this.bounceButton1.DialogResult = System.Windows.Forms.DialogResult.None;
			this.bounceButton1.Image = ((System.Drawing.Bitmap)(resources.GetObject("bounceButton1.Image")));
			this.bounceButton1.Location = new System.Drawing.Point(40, 232);
			this.bounceButton1.Name = "bounceButton1";
			this.bounceButton1.Size = new System.Drawing.Size(72, 64);
			this.bounceButton1.TabIndex = 4;
			this.bounceButton1.Text = "bounceButton1";
			// 
			// bounceButton2
			// 
			this.bounceButton2.BackColor = System.Drawing.Color.Transparent;
			this.bounceButton2.DialogResult = System.Windows.Forms.DialogResult.None;
			this.bounceButton2.Image = ((System.Drawing.Bitmap)(resources.GetObject("bounceButton2.Image")));
			this.bounceButton2.Location = new System.Drawing.Point(40, 40);
			this.bounceButton2.Name = "bounceButton2";
			this.bounceButton2.Size = new System.Drawing.Size(72, 64);
			this.bounceButton2.TabIndex = 5;
			this.bounceButton2.Text = "bounceButton2";
			this.bounceButton2.Click += new System.EventHandler(this.bounceButton2_Click);
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(24, 104);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(112, 24);
			this.label6.TabIndex = 8;
			this.label6.Text = "Change Form Region";
			// 
			// curvedPanel5
			// 
			this.curvedPanel5.AddToFormRegion = true;
			this.curvedPanel5.Anchor = ((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.curvedPanel5.BackColor = System.Drawing.Color.Transparent;
			this.curvedPanel5.BottomMargin = -1;
			this.curvedPanel5.Controls.AddRange(new System.Windows.Forms.Control[] {
																					   this.label4});
			this.curvedPanel5.FillColor = System.Drawing.SystemColors.ControlDark;
			this.curvedPanel5.FillTransparency = 1;
			this.curvedPanel5.FormBehavior = Microsoft.Samples.FormBehaviors.Drag;
			this.curvedPanel5.LeftMargin = -1;
			this.curvedPanel5.LineThickness = 0;
			this.curvedPanel5.Location = new System.Drawing.Point(3, 3);
			this.curvedPanel5.LowerLeftCornerRadius = 1;
			this.curvedPanel5.LowerLeftCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel5.LowerRightCornerRadius = 1;
			this.curvedPanel5.LowerRightCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel5.Name = "curvedPanel5";
			this.curvedPanel5.RightMargin = -1;
			this.curvedPanel5.Size = new System.Drawing.Size(474, 24);
			this.curvedPanel5.TabIndex = 8;
			this.curvedPanel5.Text = "curvedPanel5";
			this.curvedPanel5.TopMargin = -1;
			this.curvedPanel5.UpperLeftCornerRadius = 1;
			this.curvedPanel5.UpperLeftCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel5.UpperRightCornerRadius = 26;
			this.curvedPanel5.UpperRightCornerType = Microsoft.Samples.CornerTypes.Curve;
			// 
			// label4
			// 
			this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label4.Location = new System.Drawing.Point(8, 5);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(152, 23);
			this.label4.TabIndex = 0;
			this.label4.Text = "Main Application Area";
			// 
			// curvedPanel6
			// 
			this.curvedPanel6.AddToFormRegion = true;
			this.curvedPanel6.Anchor = (((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right);
			this.curvedPanel6.BackColor = System.Drawing.Color.Transparent;
			this.curvedPanel6.BottomMargin = 0;
			this.curvedPanel6.Controls.AddRange(new System.Windows.Forms.Control[] {
																					   this.curvedPanel5});
			this.curvedPanel6.FillColor = System.Drawing.SystemColors.Window;
			this.curvedPanel6.FillTransparency = 1;
			this.curvedPanel6.FormBehavior = Microsoft.Samples.FormBehaviors.None;
			this.curvedPanel6.LeftMargin = 0;
			this.curvedPanel6.LineThickness = 2;
			this.curvedPanel6.Location = new System.Drawing.Point(192, 16);
			this.curvedPanel6.LowerLeftCornerRadius = 1;
			this.curvedPanel6.LowerLeftCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel6.LowerRightCornerRadius = 1;
			this.curvedPanel6.LowerRightCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel6.Name = "curvedPanel6";
			this.curvedPanel6.RightMargin = 0;
			this.curvedPanel6.Size = new System.Drawing.Size(480, 472);
			this.curvedPanel6.TabIndex = 7;
			this.curvedPanel6.Text = "curvedPanel6";
			this.curvedPanel6.TopMargin = 0;
			this.curvedPanel6.UpperLeftCornerRadius = 1;
			this.curvedPanel6.UpperLeftCornerType = Microsoft.Samples.CornerTypes.Curve;
			this.curvedPanel6.UpperRightCornerRadius = 28;
			this.curvedPanel6.UpperRightCornerType = Microsoft.Samples.CornerTypes.Curve;
			// 
			// regionBuilder1
			// 
			this.regionBuilder1.ParentForm = this;
			// 
			// Form2
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(688, 502);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.curvedPanel6,
																		  this.curvedPanel4,
																		  this.curvedPanel1});
			this.Name = "Form2";
			this.Text = "Form2";
			this.curvedPanel1.ResumeLayout(false);
			this.curvedPanel2.ResumeLayout(false);
			this.curvedPanel3.ResumeLayout(false);
			this.curvedPanel4.ResumeLayout(false);
			this.curvedPanel5.ResumeLayout(false);
			this.curvedPanel6.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

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

		private void bounceButton3_Click(object sender, System.EventArgs e)
		{
			MessageBox.Show("Sounds click");
		}

		private void bounceButton2_Click(object sender, System.EventArgs e)
		{
			this.regionBuilder1.MakeFormRegion = !this.regionBuilder1.MakeFormRegion;
		}
	}
}