Click here to Skip to main content
15,885,032 members
Articles / Programming Languages / C#

Building Snap-In Applications

Rate me:
Please Sign up or sign in to vote.
4.89/5 (46 votes)
23 Aug 2003CPOL17 min read 105.3K   3.1K   141  
This article details how to build a Snap-In-Capable application, similar to the way that MMC works.
using System;
using System.Drawing;
using System.Windows.Forms;

namespace SnapIn
{
	/// <summary>
	/// Implement this if you want to have a container-type object.
	/// </summary>
	public interface IShell
	{
		/// <summary>
		/// Accessor to the Shell's ToolBar.
		/// </summary>
		ToolBar TheToolBar {get; set;}
		/// <summary>
		/// Accessor to the Shells' StatusBar.
		/// </summary>
		StatusBar TheStatusBar {get; set;}
	}

	/// <summary>
	/// Implement this if you want to have a snap-in-type object.
	/// </summary>
	public interface IModule
	{
		/// <summary>
		/// Give a new module a reference to the container.
		/// </summary>
		/// <param name="shell">The reference to the Shell.</param>
		void Initialize(IShell shell);
		/// <summary>
		/// Tell the module it's got the spotlight.
		/// </summary>
		void Activate();
		/// <summary>
		/// Tell the module to go away for now.
		/// </summary>
		void Deactivate();
		/// <summary>
		/// Place the module where it needs to be.
		/// </summary>
		/// <param name="topLeft">The top-left coordinate, relative to the application.</param>
		/// <param name="bottomRight">The bottom-right coordinate.</param>
		void Move(Point topLeft, Point bottomRight);
	}
}

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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
United States United States
Architect, designer and coder since the late 90's and still going strong. Cut my teeth on Perl and C++, but soon moved to VB6/ASP and then onto .NET bliss and here I remain (until something better comes along). Love talking and thinking about coding practices and techniques, so feel free to shoot me a line. Lately been getting stronger at SOA and WCF and messing around with jqGrid.

Comments and Discussions