Watermark Textbox with Email & number validation




using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
 
namespace Mesoft.Control
{
    public partial class MeTextBox : TextBox
    {
        private string MeTempText = "";
        private Boolean IsNum = false;
        private Boolean IsEmail = false;

        public MeTextBox()
        {
            TextWithWaterMark = false;
            this.Size = new System.Drawing.Size(169, 20);
            this.TextChanged += new System.EventHandler(this.meText_TextChanged);
            this.Leave += new System.EventHandler(this.meText_Leave);
            this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.meText_KeyPress);
            this.Enter += new System.EventHandler(this.meText_Enter);
            this.Validating += new CancelEventHandler(meText_Validating);
        }
        #region "CUSTOME PROPERTIES"
        [Category("Mesoft")]
        [Description("get or set watermark text")]
        public String WaterMarkText
        {
            get
            {
                return MeTempText;
            }
            set
            {
                MeTempText = value;
                this.Text = MeTempText;
                SetTextColor();
            }
        }
        [Category("Mesoft")]
        public new string Text
        {
            get
            {
                if (!TextWithWaterMark)
                {
                    if (base.Text == WaterMarkText)
                    {
                        return "";
                    }
                    else
                    {
                        return base.Text;
                    }
                }
                else
                {
                    return base.Text;
                }
            }
            set
            {
                base.Text = value;
            }
        }
        [Category("Mesoft")]
        public String TextWithNull
        {
            get
            {
                if (this.Text == WaterMarkText)
                {
                    return "NULL";
                }
                else
                {
                    return Text;
                }
            }
        }
        [Category("Mesoft")]
        [Description("set true metextbox as numbertextbox")]
        public Boolean NumberTextBox
        {
            get
            {
                return IsNum;
            }
            set
            {
                IsNum = value;
                if (IsNum)
                {
                    IsEmail = false;
                }
            }
        }
        [Category("Mesoft")]
        [Description("set true metextbox email validate textbox")]
        public Boolean EmailTextBox
        {
            get
            {
                return IsEmail;
            }
            set
            {
                IsEmail = value;
                if (IsEmail)
                {
                    IsNum = false;
                }
            }
        }
        [Category("Mesoft")]
        [Description("If you want return text with watermark also make it true.")]
        public Boolean TextWithWaterMark
        {
            get;
            set;
        }
        #endregion
        #region "CUSTOME METHOD"
        private void SetTextColor()
        {
            try
            {
                string temp = this.Text;
                if (temp == "")
                {
                    temp = WaterMarkText;
                }
                if (temp == WaterMarkText)
                {
                    this.ForeColor = Color.Silver;
                }
                else
                {
                    this.ForeColor = Color.Black;
                }
            }
            catch (Exception ex)
            {
                General.ErrorMessage(ex.Message);
            }
        }
        protected override void OnCreateControl()
        {
            base.OnCreateControl();
        }
        public new void Clear()
        {
            this.Text = WaterMarkText;
        }
        #endregion
        #region "EVETN"
        private void meText_TextChanged(object sender, EventArgs e)
        {
            try
            {
                SetTextColor();
            }
            catch (Exception ex)
            {
                General.ErrorMessage(ex.Message);
            }
        }
        private void meText_Enter(object sender, EventArgs e)
        {
            try
            {
                string temp = this.Text;
                if (temp == "")
                {
                    temp = WaterMarkText;
                }
                if (temp == WaterMarkText)
                {
                    this.Text = "";
                }
            }
            catch (Exception ex)
            {
                General.ErrorMessage(ex.Message);
            }
        }
        private void meText_Leave(object sender, EventArgs e)
        {
            try
            {
                if (this.Text == "")
                {
                    this.Text = WaterMarkText;
                }
            }
            catch (Exception ex)
            {
                General.ErrorMessage(ex.Message);
            }
        }
        private void meText_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
               if (NumberTextBox)
                {
                    if (!char.IsNumber(e.KeyChar) && e.KeyChar != '.' && e.KeyChar != '\b')
                    {
                        e.Handled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                General.ErrorMessage(ex.Message);
            }
        }
        private void meText_Validating(object sender, CancelEventArgs e)
        {
            try
            {
                if (IsEmail)
                {
                    if (this.Text != "" && this.Text != WaterMarkText)
                    {
                        Mesoft.Extra.Validation ObjVal = new Mesoft.Extra.Validation();
                        ObjVal.IsValidationEmail(this.Text);
                    }
                }
            }
            catch (Exception ex)
            {
                e.Cancel = true;
                General.ErrorMessage(ex.Message);
            }
        }
        #endregion
    }
}

Time Column For DataGridView



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
namespace Mesoft.Control
{
    using System.Windows.Forms;
    public class TimeColumn : DataGridViewColumn
    {
        public TimeColumn()
            : base(new TimeCell())
        { 
        }
        public TimeColumn(string frm)
            : base(new TimeCell(frm))
        {
        }
        public void setValue(string frm)
        {
            base.CellTemplate.Value = frm;
        }
        [Category("Mesoft")]
        public override DataGridViewCell CellTemplate
        {
            get
            {
                return base.CellTemplate;
            }
            set
            {
                if (value != null && !value.GetType().IsAssignableFrom(typeof(TimeCell)))
                {
                    throw new InvalidCastException("Must be a TimeCell");
                }
                base.CellTemplate = value;
            }
        }
    }
    public class TimeCell : DataGridViewTextBoxCell
    {
        public TimeCell()
            : base()
        {
            this.Style.Format = "hh:mm tt";
        }
        public TimeCell(string frm)
            : base()
        {
            this.Style.Format = frm;
        }
        public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
        {
            try
            {
                base.InitializeEditingControl(rowIndex, initialFormattedValue, dataGridViewCellStyle);
                TimeEditingControl ctl = DataGridView.EditingControl as TimeEditingControl;
                ctl.Format = DateTimePickerFormat.Time;
                ctl.ShowUpDown = true;
                ctl.Value = (DateTime)this.Value;
            }
            catch { }
        }
        [Category("Mesoft")]
        public override Type EditType
        {
            get
            {
                return typeof(TimeEditingControl);
            }
        }
        [Category("Mesoft")]
        public override Type ValueType
        {
            get
            {
                return typeof(DateTime);
            }
        }
        [Category("Mesoft")]
        public override object DefaultNewRowValue
        {
            get
            {
                return DateTime.Now;
            }
        }
    }
    class TimeEditingControl : DateTimePicker, IDataGridViewEditingControl
    {
        DataGridView dataGridView;
        private bool valueChanged = false;
        int rowIndex;
        public TimeEditingControl()
        {
            this.Format = DateTimePickerFormat.Custom;
        }
        [Category("Mesoft")]
        public object EditingControlFormattedValue
        {
            get
            {
                return this.Value.ToShortTimeString();
            }
            set
            {
                String newValue = value as String;
                if (newValue != null)
                {
                    this.Value = DateTime.Parse(newValue);
                }
            }
        }
        public object GetEditingControlFormattedValue(DataGridViewDataErrorContexts context)
        {
            return EditingControlFormattedValue;
        }
        public void ApplyCellStyleToEditingControl(DataGridViewCellStyle dataGridViewCellStyle)
        {
            this.Font = dataGridViewCellStyle.Font;
        }
        [Category("Mesoft")]
        public int EditingControlRowIndex
        {
            get
            {
                return rowIndex;
            }
            set
            {
               rowIndex = value;
            }
        }
        public bool EditingControlWantsInputKey(Keys key, bool dataGridViewWantsInputKey)
        {
            switch (key & Keys.KeyCode)
            {
                case Keys.Left:
               case Keys.Up:
                case Keys.Down:
                case Keys.Right:
                case Keys.Home:
                case Keys.End:
                case Keys.PageDown:
                case Keys.PageUp:
                case Keys.Tab:
                    return true;
                default:
                    return false;
            }
        }
        public void PrepareEditingControlForEdit(bool selectAll){}
        [Category("Mesoft")]
        public bool RepositionEditingControlOnValueChange
        {
            get
            {
                return false;
            }
        }
        [Category("Mesoft")]
        public DataGridView EditingControlDataGridView
        {
            get
            {
               return dataGridView;
            }
            set
            {
                dataGridView = value;
           }
        }
        [Category("Mesoft")]
       public bool EditingControlValueChanged
       {
            get
            {
                return valueChanged;
            }
            set
            {
                valueChanged = value;
            }
        }
        [Category("Mesoft")]
        public Cursor EditingPanelCursor
        {
            get
            {
                return base.Cursor;
            }
        }
        protected override void OnValueChanged(EventArgs eventargs)
        {
            valueChanged = true;
            this.EditingControlDataGridView.NotifyCurrentCellDirty(true);
            base.OnValueChanged(eventargs);
        }
    }
}

CalenderColumn For DataGridView





using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;
namespace Mesoft.Control
{
    public class CalendarColumn : DataGridViewColumn
    {
        public CalendarColumn() : base(new CalendarCell())
        {
        }
        public override DataGridViewCell CellTemplate
        {
            get
            {
                return base.CellTemplate;
            }
            set
           {
                if (value != null && !value.GetType().IsAssignableFrom(typeof(CalendarCell)))
                {
                    throw new InvalidCastException("Must be a CalendarCell");
                }
                base.CellTemplate = value;
            }
        }
    }
    public class CalendarCell : DataGridViewTextBoxCell
    {
        public CalendarCell(): base()
        {
            this.Style.Format = "d";
        }
        public override void InitializeEditingControl(int rowIndex, object initialFormattedValue, DataGridViewCellStyle dataGridViewCellStyle)
        {
            base.InitializeEditingControl(rowIndex, initialFormattedValue,
            dataGridViewCellStyle);
            CalendarEditingControl ctl =
            DataGridView.EditingControl as CalendarEditingControl;
            ctl.Value = (DateTime)this.Value;
        }
        public override Type EditType
        {
            get
            {
                return typeof(CalendarEditingControl);
            }
        }
        public override Type ValueType
        {
            get
            {
                return typeof(DateTime);
            }
        }
        public override object DefaultNewRowValue
        {
            get
            {
                return DateTime.Now;
            }
        }
    }
    class CalendarEditingControl : DateTimePicker, IDataGridViewEditingControl
    {
        DataGridView dataGridView;
        private bool valueChanged = false;
        int rowIndex;
        public CalendarEditingControl()
        {
            this.Format = DateTimePickerFormat.Short;
        }
        [Category("Mesoft")]
        public object EditingControlFormattedValue
        {
            get
            {
                return this.Value.ToShortDateString();
            }
            set
            {
                if (value is String)
                {
                    this.Value = DateTime.Parse((String)value);
                }
            }
        }
        public object GetEditingControlFormattedValue(DataGridViewDataErrorContexts context)
        {
            return EditingControlFormattedValue;
        }
        public void ApplyCellStyleToEditingControl(DataGridViewCellStyle dataGridViewCellStyle)
        {
            this.Font = dataGridViewCellStyle.Font;
            this.CalendarForeColor = dataGridViewCellStyle.ForeColor;
            this.CalendarMonthBackground = dataGridViewCellStyle.BackColor;
        }
        [Category("Mesoft")]
        public int EditingControlRowIndex
        {
            get
            {
                return rowIndex;
            }
            set
            {
                rowIndex = value;
            }
        }
        public bool EditingControlWantsInputKey(Keys key, bool dataGridViewWantsInputKey)
        {
            switch (key & Keys.KeyCode)
            {
                case Keys.Left:
                case Keys.Up:
                case Keys.Down:
                case Keys.Right:
                case Keys.Home:
                case Keys.End:
                case Keys.PageDown:
                case Keys.PageUp:
                    return true;
                default:
                    return false;
            }
        }
        public void PrepareEditingControlForEdit(bool selectAll)
        {
        }
        [Category("Mesoft")]
        public bool RepositionEditingControlOnValueChange
        {
            get
            {
                return false;
            }
        }
        [Category("Mesoft")]
        public DataGridView EditingControlDataGridView
        {
            get
            {
                return dataGridView;
            }
            set
            {
                dataGridView = value;
            }
        }
        [Category("Mesoft")]
        public bool EditingControlValueChanged
        {
            get
            {
                return valueChanged;
            }
            set
            {
                valueChanged = value;
            }
        }
        [Category("Mesoft")]
        public Cursor EditingPanelCursor
        {
            get
            {
                return base.Cursor;
            }
        }
        protected override void OnValueChanged(EventArgs eventargs)
        {
            valueChanged = true;
            this.EditingControlDataGridView.NotifyCurrentCellDirty(true);
            base.OnValueChanged(eventargs);
        }
    }
}

Customize TitleBar





using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace Mesoft.Control
{
    public partial class TitleBar : UserControl
    {
        public const int WM_NCLBUTTONDOWN = 0xA1;
        public const int HT_CAPTION = 0x2;
        [DllImportAttribute("user32.dll")]
        public static extern int SendMessage(IntPtr hWnd,int Msg, int wParam, int lParam);
        [DllImportAttribute("user32.dll")]
        public static extern bool ReleaseCapture();
        public TitleBar()
        {
            InitializeComponent();
        }
        private void TitleBar_Load(object sender, EventArgs e)
        {
            this.Dock = DockStyle.Top;
            lblTitle.ForeColor = Color.White;
            this.SendToBack();
            this.lblTitle.Font = new System.Drawing.Font("Calibri", 11.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        }
        private void pbTitle_MouseDown(object sender, MouseEventArgs e)
        {
        }
        private void pbTitle_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (frmControlBox.Maximize)
            {
                if (this.ParentForm.WindowState == FormWindowState.Maximized)
                {
                    this.ParentForm.WindowState = FormWindowState.Normal;
                    this.ParentForm.Show();
                }
                else if (this.ParentForm.WindowState == FormWindowState.Normal)
                {
                    this.ParentForm.WindowState = FormWindowState.Maximized;
                    this.ParentForm.Show();
                }
            }
        }
        private void Caption_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                if ((e.Clicks == 1) && (this.ParentForm.WindowState != FormWindowState.Maximized))
                {
                    ReleaseCapture();
                    SendMessage(this.ParentForm.Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
                }
            }
        }
        [Category("Mesoft")]
        [Description("Gets or sets the font of the title")
        public Font TitleFont
        {
            set
            {
                lblTitle.Font = value;
            }
            get
            {
                return lblTitle.Font;
            }
        }
        [Category("Mesoft")]
        [Description("Gets or sets the title of the title bar")]
        public string Titl
        {
            set
            {
                lblTitle.Text = value;
            }
            get
            {
                return lblTitle.Text;
            }
        }
        [Category("Mesoft")]
        [Description("Gets or sets the title align")]
        public ContentAlignment TitleTextAlign
        {
            set
            {
              lblTitle.TextAlign = value;
            }
            get
            {
                return lblTitle.TextAlign
            }
        }
        [Category("Mesoft")]
        [Description("Gets or sets the title text color")]
        public Color TitleForeColor
        {
            set
            {
                lblTitle.ForeColor = value;
            }
            get
            {
                return lblTitle.ForeColor;
            }
        }
        [Category("Mesoft")]
        [Description("Gets or sets the title background color")]
        [DisplayName("TitleColor")]
        public Color TitleBackColor
        {
            set
            {
                lblTitle.BackColor = value;
            }
            get
            {
                return lblTitle.BackColor;
            }
        }
        [Category("Mesoft")]
        [Description("Gets or sets maximize button visibility")]
        public bool Maximize
        {
            set
            {
                frmControlBox.Maximize = value;
            }
            get
            {
                return frmControlBox.Maximize;
            }
        }
        [Category("Mesoft")]
        [Description("Gets or sets minimize button visibility")]
        public bool Minimize
        {
            set
            {
               frmControlBox.Minimize = value;
            }
            get
            {
                return frmControlBox.Minimize;
            }
        }
        [Category("Mesoft")]
        [Description("Gets or sets close button visibility")]
        public bool Close
        {
            set
            {
                frmControlBox.Close = value;
            }
            get
            {
                return frmControlBox.Close;
            }
        }
        private void lblTitle_DoubleClick(object sender, EventArgs e)
        {
            if (frmControlBox.Maximize)
            {
                if (this.ParentForm.WindowState == FormWindowState.Maximized)
                {
                    this.ParentForm.WindowState = FormWindowState.Normal;
                    this.ParentForm.Show();
                }
                else if (this.ParentForm.WindowState == FormWindowState.Normal)
                {
                    this.ParentForm.WindowState = FormWindowState.Maximized;
                    this.ParentForm.Show();
                }
            }
        }
    }
}

ControlBox for Windows Form



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace Mesoft.Control
{
    public partial class ControlBox : UserControl
    {
        [Category("Mesoft")]
        [Description("Gets or sets maximize button visibility")]
        public bool Maximize
        {
            set
            {
                lblMaximize.Visible = value;   
            }
            get
            {
                return lblMaximize.Visible; 
            }
        }
        [Category("Mesoft")]
        [Description("Gets or sets minimize button visibility")]
        public bool Minimize
        {
            set
            {
                lblMinimize.Visible = value;
            }
            get
            {
                return lblMinimize.Visible;
            }
        }
        [Category("Mesoft")]
        [Description("Gets or sets close button visibility")]
        public bool Close
        {
            set
            {
                lblClose.Visible = value;
            }
            get
            {
                return lblClose.Visible;
            }
        }
        public ControlBox()
       {
            InitializeComponent();
        }
        private void lblClose_MouseMove(object sender, MouseEventArgs e)
        {
            lblClose.Image = global::Mesoft.Properties.Resources.CloseHover1;     
        }
        private void lblClose_MouseLeave(object sender, EventArgs e)
        {
            lblClose.Image = global::Mesoft.Properties.Resources._1310834635_Close_Box_Red;      
        }
        private void lblMaximize_MouseLeave(object sender, EventArgs e)
        {
            lblMaximize.Image = global::Mesoft.Properties.Resources.index;     
        }
        private void lblMaximize_MouseMove(object sender, MouseEventArgs e)
        {
            lblMaximize.Image = global::Mesoft.Properties.Resources.MaximizeHover;     
        }
        private void lblMinimize_MouseMove(object sender, MouseEventArgs e)
        {
            lblMinimize.Image = global::Mesoft.Properties.Resources.MinimizeNewHover;     
        }
        private void lblMinimize_MouseLeave(object sender, EventArgs e)
        {
            lblMinimize.Image = global::Mesoft.Properties.Resources.MinimizeNew;     
        }
        private void lblClose_Click(object sender, EventArgs e)
        {
          this.ParentForm.Close();   
        }
        private void lblMaximize_Click(object sender, EventArgs e)
        {
            if (this.ParentForm.WindowState == FormWindowState.Maximized)
            {
                this.ParentForm.WindowState = FormWindowState.Normal;
            }
            else if(this.ParentForm.WindowState == FormWindowState.Normal)
            {
              this.ParentForm.WindowState = FormWindowState.Maximized;
           }
            this.ParentForm.Show();   
        }
        private void lblMinimize_Click(object sender, EventArgs e)
        {
            this.ParentForm.WindowState = FormWindowState.Minimized;
            this.ParentForm.Show(); 
        }
        private void FormControlBox_Load(object sender, EventArgs e)
        { 
        }
    }
}

Screen Saver

/********************************************************
* User screen saver developer can also
* use animate effects for this screen saver
*********************************************************/

using System.Runtime.InteropServices;
using Microsoft.Win32;
namespace Mesoft.Control
{
    public partial class MeScreenSaver : Form
    {
        #region Win32 API functions
        [DllImport("user32.dll")]
        static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent);
        [DllImport("user32.dll")]
        static extern int SetWindowLong(IntPtr hWnd, int nIndex, IntPtr dwNewLong);
        [DllImport("user32.dll", SetLastError = true)]
        static extern int GetWindowLong(IntPtr hWnd, int nIndex);
        [DllImport("user32.dll")]
        static extern bool GetClientRect(IntPtr hWnd, out Rectangle lpRect);
        #endregion
        private Point mouseLocation;
        private bool previewMode = false;
        private Random rand = new Random();
        public MeScreenSaver()
        {
            InitializeComponent();
        }
        public static void ShowScreenSaver()
        {
            foreach (Screen screen in Screen.AllScreens)
            {
                MeScreenSaver screensaver = new MeScreenSaver(screen.Bounds);
                screensaver.Show();
            }
        }
        public MeScreenSaver(Rectangle Bounds)
        {
            InitializeComponent();
            this.Bounds = Bounds;
        }
        public MeScreenSaver(IntPtr PreviewWndHandle)
        {
            InitializeComponent();
            // Set the preview window as the parent of this window
            SetParent(this.Handle, PreviewWndHandle);
            // Make this a child window so it will close when the parent dialog closes
            SetWindowLong(this.Handle, -16, new IntPtr(GetWindowLong(this.Handle, -16) | 0x40000000));
            // Place our window inside the parent
            Rectangle ParentRect;
            GetClientRect(PreviewWndHandle, out ParentRect);
            Size = ParentRect.Size;
            Location = new Point(0, 0);
            // Make text smaller
            txtLabel.Font = new System.Drawing.Font("Arial", 6);
            previewMode = true;
        }
        private void ScreenSaverForm_Load(object sender, EventArgs e)
        {            
            LoadSettings();
            Cursor.Hide();            
            TopMost = true;
            PicBox.Image = Mesoft.Drawing.MeImage.DrawReflection(PicBox.Image, Color.Black);
            moveTimer.Interval = 1000;
            moveTimer.Tick += new EventHandler(moveTimer_Tick);
            moveTimer.Start();
        }
        private void moveTimer_Tick(object sender, System.EventArgs e)
        {
            // Move text to new location
            PicBox.Left = rand.Next(Math.Max(1, Bounds.Width - PicBox.Width));
            PicBox.Top = rand.Next(Math.Max(1, Bounds.Height - PicBox.Height));            
        }
        private void LoadSettings()
        {
            // Use the string from the Registry if it exists
            RegistryKey key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Demo_ScreenSaver");
            if (key == null)
                txtLabel.Text = "Mesoft Technologies";
            else
                txtLabel.Text = (string)key.GetValue("text");
        }
        private void ScreenSaverForm_MouseMove(object sender, MouseEventArgs e)
        {
            if (!previewMode)
            {
                if (!mouseLocation.IsEmpty)
                {
                    // Terminate if mouse is moved a significant distance
                    if (Math.Abs(mouseLocation.X - e.X) > 5 ||
                        Math.Abs(mouseLocation.Y - e.Y) > 5)
                        Application.Exit();
                }
                mouseLocation = e.Location;
            }
        }
        private void ScreenSaverForm_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!previewMode)
                Application.Exit();
        }
        private void ScreenSaverForm_MouseClick(object sender, MouseEventArgs e)
        {
            if (!previewMode)
                Application.Exit();
        }
    }
}

Transperant Form





public class MeTransperantPanel : System.Windows.Forms.Form
{
    private System.ComponentModel.Container components = null;
    public MeTransperantPanel()
    {
        InitializeComponent();
        this.Opacity = 0.6;
    }
    public MeTransperantPanel(Form owner) : this()
    {
        this.Owner = owner;
        this.Owner.Layout += new LayoutEventHandler(this.OwnerLayoutChanged);
        this.Owner.Move += new EventHandler(this.OwnerMoved);
        this.Owner.Closed += new EventHandler(this.OwnerClosed);
    }
    private void OwnerLayoutChanged(object sender, System.Windows.Forms.LayoutEventArgs e)
    {
        MoveMeGlassPane();
    }
    private void OwnerMoved(object sender, System.EventArgs e)
    {
        MoveMeGlassPane();
    }
    private void OwnerClosed(object sender, System.EventArgs e)
    {
        this.Close();
    }
    private void MoveMeGlassPane()
    {
        this.Location = new Point(this.Owner.Location.X+2, this.Owner.Location.Y+35);
        this.Width = this.Owner.Width - 4;
        this.Height = this.Owner.Height - 37;
    }
    protected override void Dispose( bool disposing )
    {
        if( disposing )
        {
            if (components != null)
            {
                components.Dispose();
            }
        }
        base.Dispose( disposing );
    }
    #region Windows Form Designer generated code
    ///
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    ///
    private void InitializeComponent()
    {
        this.SuspendLayout();
        //
        // MeGlassPane
       //
        this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
        this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(255)), ((System.Byte)(255)), ((System.Byte)(192)));
        this.ClientSize = new System.Drawing.Size(528, 260);
        this.ControlBox = false;
        this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
        this.MaximizeBox = false;
        this.MinimizeBox = false;
        this.Name = "MeGlassPane";
        this.Opacity = 0.8;
        this.ShowInTaskbar = false;
        this.ResumeLayout(false);
    }
    #endregion
}
/*
* To Implement this code just inherited in form
*/
public partial class Form1 : MeTransperantPanel
{
}