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,649 times
Add to favorites
2/2/2011
E-mail Twitter del.icio.us Digg Facebook

Solution explorer

C#
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;
using System.Drawing.Design;


namespace Microsoft.Samples
{
	/// <summary>
	/// Summary description for IRegionControl.
	/// </summary>
	public interface IRegionControl
	{
		// This property indicates whether the control's region should be
		// added to the Form's
		bool AddToFormRegion { get; set; }

		// This method returns a properly offset Region object
		// based on the control's shape.
		//
		// Properly offset means offset in relation to the form border's
		// Top and Left coordinates.
		//
		// The code to offset might look something like:
		//
		//		int borderSize = (parent.Width - parent.ClientRectangle.Width) / 2;
		//		int titlebarSize = parent.Height - parent.ClientRectangle.Height - borderSize;
		//		region.Translate(this.Location.X + borderSize, this.Location.Y + titlebarSize);
		//
		Region MakeRegion(Form parent);
	}
}