Click here to Skip to main content
15,896,154 members
Articles / Desktop Programming / Windows Forms

Simple Carousel Control for Windows Forms

Rate me:
Please Sign up or sign in to vote.
3.33/5 (7 votes)
24 Apr 2012CPOL2 min read 59.4K   8K   31  
Simple Carousel Control for Windows Forms, can host any content with in views.
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing;

namespace Creatives.Windows.Controls
{
	[ToolboxItem(false),TypeConverter(typeof(ViewTypeConverter))]
	public class View : Panel
	{
		#region Ctor

		public View()
		{
			BackColor = Color.GreenYellow;
			SetStyle(ControlStyles.UserPaint, true);
			SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
			SetStyle(ControlStyles.AllPaintingInWmPaint, true);
		}

		#endregion
		
		#region Overriden Members

		protected override void WndProc(ref Message m)
		{
			base.WndProc(ref m);

			if (m.Msg == 0x0201 /*WM_LBUTTONDOWN*/)
			{
				if (this.Activated != null)
					Activated(this, EventArgs.Empty);
			}
		}

		#endregion

		#region Events and Handlers

		public event EventHandler Activated;

		#endregion
	}
}

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
India India
I code, learn, read and listen.

Comments and Discussions