Click here to Skip to main content
15,880,956 members
Articles / Programming Languages / C#

Unleash PropertyGrid with Dynamic Properties and Globalization

Rate me:
Please Sign up or sign in to vote.
4.97/5 (24 votes)
29 Jan 2004CPOL9 min read 126.1K   4.8K   88  
The article presents a way to enhance the use of the PropertyGid control with dynamic properties and globalization
using System;
using System.Windows.Forms;
using System.Drawing;
using CustomControls.Enumerations;

namespace CustomControls.HelperClasses
{
	public class EditControl:TextBox
	{
		
		public new  BorderStyle BorderStyle
		{
			get{return BorderStyle.FixedSingle;}
		}


		public EditControl()
		{
			base.BorderStyle=BorderStyle.FixedSingle;
		}



		protected override  void WndProc(ref Message m)
		{			
			base.WndProc(ref m);		
			if(m.Msg==(int)Msgs.WM_PAINT){PaintBorder();}			
		}

		private void PaintBorder()
		{
			using (Graphics g=this.CreateGraphics())
			{
				Color borderColor =this.BackColor;
				
				using (Pen pen= new Pen(borderColor))
				{
					g.DrawRectangle(pen,new Rectangle(0,0,this.Width-1, this.Height-1));
				}
				
			}
		}

	}
}

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
Web Developer
Romania Romania
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions