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
{
} 

Control Animator




using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace Mesoft.Animation
{
    public class MeSlide
    {
        private int counter = 0;
        private int timeStart;
        private int timeDest;
        private AnimationType Animation;
        private float t;
        private float d;
        private float b;
        private float c;
        private int[] Arr_startPos = new int[]{0,0};
        private int[] Arr_destPos = new int[]{0,0};
        private System.Windows.Forms.Timer objTimer;
        private System.Windows.Forms.Control objHolder;
        private System.ComponentModel.IContainer components;
        private System.Windows.Forms.Timer timer1;
        public void StartSlideEvent(object _objHolder, int _destXpos, int _destYpos, AnimationType ObjAnimationType, int _timeInterval)
        {
            //inits the parameters for the tween process
            counter = 0;
            timeStart = counter;
            timeDest = _timeInterval;
            Animation = ObjAnimationType;
            this.components = new System.ComponentModel.Container();
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            this.timer1.Interval = 1;
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            //Manages the object passed in to be tweened.
            //I create a new instance of a control and then force the object to convert to
            //a control. Doing it this way, the method accepts ANY control,
            //rather than hard-coding "Button" or some other specific control.
            objHolder = new System.Windows.Forms.Control();
            objHolder = (System.Windows.Forms.Control) _objHolder;
            objTimer = this.timer1;
            //initializes the object's position in the pos Arrays
            Arr_startPos[0] = objHolder.Location.X;
            Arr_startPos[1] = objHolder.Location.Y;
            Arr_destPos[0] = _destXpos;
            Arr_destPos[1] = _destYpos;
            //resets the timer and finally starts it
            objTimer.Stop();
            objTimer.Enabled = false;
            objTimer.Enabled = true;
        }
        ///
        ///This is the method that gets called every tick interval
        ///
        private void timer1_Tick(object sender, System.EventArgs e) 
        {
            if(objHolder.Location.X == Arr_destPos[0] && objHolder.Location.Y == Arr_destPos[1]) 
            {
                objTimer.Stop();
                objTimer.Enabled = false;
            }
            else
            {
               objHolder.Location = new System.Drawing.Point(Slide(0), Slide(1));
                counter++;
            }
        }
        ///
        ///This method returns a value from the tween formula.
        ///
        private int Slide(int prop)
        {
            t = (float)counter - timeStart;
            b = (float)Arr_startPos[prop];
            c = (float)Arr_destPos[prop] - Arr_startPos[prop];
            d = (float)timeDest - timeStart;
            return getFormula(Animation, t, b, d, c);
        }
        public AnimationType AnimationTypeStlye
        {
            get;
            set;
        }
        ///
        ///this method selects which formula to pick and then returns a number for the tween position of the pictureBox
        ///
        private int getFormula(AnimationType ObjAnimationType, float t, float b, float d, float c)
        {
        //adjust formula to selected algoritm from combobox
            switch (ObjAnimationType)
           {
                case AnimationType.Linear:
                // simple linear tweening - no easing
                return (int)(c*t/d+b);
                case AnimationType.EaseinQuad:
                // quadratic (t^2) easing in - accelerating from zero velocity
                return (int)(c*(t/=d)*t + b);
                case AnimationType.EaseoutQuad:
                // quadratic (t^2) easing out - decelerating to zero velocity
                return (int)(-c*(t=t/d)*(t-2)+b);
                case AnimationType.EaseinoutQuad:
                // quadratic easing in/out - acceleration until halfway, then deceleration
                if ((t/=d/2)<1) return (int)(c/2*t*t+b); else return (int)(-c/2*((--t)*(t-2)-1)+b);
                case AnimationType.EaseinCubic:
                // cubic easing in - accelerating from zero velocity
                return (int)(c*(t/=d)*t*t + b);
                case AnimationType.EaseoutCubic:
                // cubic easing in - accelerating from zero velocity
                return (int)(c*((t=t/d-1)*t*t + 1) + b);
                case AnimationType.EaseinoutCubic:
                // cubic easing in - accelerating from zero velocity
                if ((t/=d/2) < 1)return (int)(c/2*t*t*t+b);else return (int)(c/2*((t-=2)*t*t + 2)+b);
                case AnimationType.EaseinQuart:
                // quartic easing in - accelerating from zero velocity
                return (int)(c*(t/=d)*t*t*t + b);
                case AnimationType.EaseinExpo:
                // exponential (2^t) easing in - accelerating from zero velocity
                if (t==0) return (int)b; else return (int)(c*Math.Pow(2,(10*(t/d-1)))+b);
                case AnimationType.EaseoutExpo:
                // exponential (2^t) easing out - decelerating to zero velocity
                if (t==d) return (int)(b+c); else return (int)(c * (-Math.Pow(2,-10*t/d)+1)+b);
                default:
                return 0;
            }
        }
    }
    public enum AnimationType
    {
        Linear = 0,
        EaseinQuad = 1,
        EaseoutQuad = 2,
        EaseinoutQuad = 3,
        EaseinCubic = 4,
        EaseoutCubic = 5,
        EaseinoutCubic = 6,
        EaseinQuart = 7,
        EaseinExpo = 8,
        EaseoutExpo = 9
    }
}
/*--------------Implement in form-----------------------------*/
Mesoft.Animation.MeSlide s = new Mesoft.Animation.MeSlide();
s.StartSlideEvent(this, 200, 0, Mesoft.Animation.AnimationType.EaseinCubic, 100); 

Draw Image Reflection





public static Image DrawReflection(Image img, Color toBG)
{
    int height = img.Height + 100;
    Bitmap bmp = new Bitmap(img.Width, height, PixelFormat.Format64bppPArgb);
    Brush brsh = new LinearGradientBrush(new Rectangle(0, 0, img.Width + 10, height), Color.Transparent, toBG, LinearGradientMode.Vertical);//The Brush that generates the fading effect to a specific color of your background.
    bmp.SetResolution(img.HorizontalResolution, img.VerticalResolution);
    using (Graphics grfx = Graphics.FromImage(bmp))
    {
        Bitmap bm = (Bitmap)img;
        grfx.DrawImage(bm, 0, 0, img.Width, img.Height);
        Bitmap bm1 = (Bitmap)img;
        bm1.RotateFlip(RotateFlipType.Rotate180FlipX);
        grfx.DrawImage(bm1, 0, img.Height);
        Rectangle rt = new Rectangle(0, img.Height, img.Width, 100);
        grfx.FillRectangle(brsh, rt);
    }
    return bmp;
    }
}
private void Form1_Load(object sender, EventArgs e)
{
    pictureBox1.Image = Mesoft.General.DrawReflection(pictureBox1.Image, Color.Black);
}

Glass Effected Button



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace Mesoft.Control
{
    public class MeGlassButton : Button
    {
        #region properties
        private Bitmap _bmpBackBuffer;
        private State _status;
        [Category("Mesoft")]
        private State ButtonStatus
        {
            get { return _status; }
            set
            {
                _status = value;
                _bmpBackBuffer = null;
                this.Refresh();
            }
        }
        private enum State
        {
            Normal,
            Hover,
            Click
        }
        [Category("Mesoft")]
        private enum RectangleCorners
        {
            None = 0, TopLeft = 1, TopRight = 2,
            BottomLeft = 4, BottomRight = 8,
            All = TopLeft | TopRight | BottomLeft | BottomRight
        }
        private int _radius = 6;
        [Category("Mesoft")]
        public int RoundedCornerRadius
        {
            get { return _radius; }
            set { _radius = value; ButtonStatus = _status; }
        }
        private bool _antialias = true;
        [Category("Mesoft")]
        public bool FontAntiAlias
        {
            get { return _antialias; }
            set { _antialias = value; ButtonStatus = _status; }
        }
        [Category("Mesoft")]
        public override ContentAlignment TextAlign
        {
            get
            {
                return base.TextAlign;
            }
            set
            {
                base.TextAlign = value;
                ButtonStatus = _status;
            }
        }
        [Category("Mesoft")]
        public override Color BackColor
        {
            get
            {
                return base.BackColor;
            }
            set
            {
                base.BackColor = value;
                ButtonStatus = _status;
            }
        }
        [Category("Mesoft")]
        public override string Text
        {
            get
            {
                return base.Text;
            }
            set
            {
               base.Text = value;
                ButtonStatus = _status;
            }
        }
        [Category("Mesoft")]
        public override Font Font
        {
            get
            {
               return base.Font;
            }
            set
            {
                base.Font = value;
                ButtonStatus = _status;
            }
        }
        [Category("Mesoft")]
        public override Color ForeColor
        {
            get
            {
                return base.ForeColor;
            }
            set
            {
                base.ForeColor = value;
                ButtonStatus = _status;
            }
        }
        #endregion
        public MeGlassButton()
        {
            InitializeComponent();
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.DoubleBuffer, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.Selectable, true);
            this.SetStyle(ControlStyles.UserPaint, true);
        }
        private void InitializeComponent()
        {
            this.Size = new System.Drawing.Size(100, 32);
            this.Font = new Font("Calibri", 12, FontStyle.Bold);
            this.ForeColor = Color.White;
            this.MouseEnter += new System.EventHandler(this.GlassButton_MouseEnter);
            this.MouseLeave += new System.EventHandler(this.GlassButton_MouseLeave);
            this.MouseDown += new MouseEventHandler(GlassButton_MouseDown);
            this.MouseUp += new MouseEventHandler(GlassButton_MouseUp);
            this.Resize += new EventHandler(GlassButton_Resize);
        }
        void GlassButton_Resize(object sender, EventArgs e)
       {
            ButtonStatus = State.Normal;
        }
        private void GlassButton_MouseUp(object sender, MouseEventArgs e)
        {
            ButtonStatus = State.Hover;
        }
        private void GlassButton_MouseDown(object sender, MouseEventArgs e)
        {
            ButtonStatus = State.Click
        }
        private void GlassButton_MouseLeave(object sender, EventArgs e)
        {
            ButtonStatus = State.Normal;
        }
        private void GlassButton_MouseEnter(object sender, EventArgs e)
        {
            ButtonStatus = State.Hover;
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
            e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            if (_bmpBackBuffer == null)
            {
                DrawButton(ref _bmpBackBuffer);
            }
            if (_bmpBackBuffer != null)
            {
                e.Graphics.DrawImage(_bmpBackBuffer, e.ClipRectangle, e.ClipRectangle, GraphicsUnit.Pixel);
            }
        }
        private void DrawButton(ref Bitmap bmp)
        {
            if (bmp == null)
            {
                bmp = new Bitmap(this.ClientSize.Width, this.ClientSize.Height);
            }
            using (Graphics gr = Graphics.FromImage(bmp))
            {
                DrawGlass(gr, new Rectangle(0, 0, this.Width, this.Height));
            }
        }
        private void DrawGlass(Graphics gr, Rectangle rectBar)
        {
            // Some calculations
            if (rectBar.Height <= 0) rectBar.Height = 1;
            int nAlphaStart = (int)(185 + 5 * rectBar.Width / 24),
                nAlphaEnd = (int)(10 + 4 * rectBar.Width / 24);
            if (nAlphaStart > 255) nAlphaStart = 255;
            else if (nAlphaStart < 0) nAlphaStart = 0;
            if (nAlphaEnd > 255) nAlphaEnd = 255;
            else if (nAlphaEnd < 0) nAlphaEnd = 0;
            Color ColorBacklight;
            Color ColorFillBK;
            Color ColorBorder;
            switch (_status)
            {
                case State.Click:
                    ColorBacklight = GetDarkerColor(this.BackColor, 20);
                    ColorFillBK = GetDarkerColor(this.BackColor, 40);
                    ColorBorder = GetDarkerColor(this.BackColor, 60);
                    break;
                case State.Hover:
                    ColorBacklight = GetLighterColor(this.BackColor, 5);
                    ColorFillBK = GetLighterColor(this.BackColor, 10);
                    ColorBorder = GetDarkerColor(this.BackColor, 100);
                    break;
                case State.Normal:
                default:
                    ColorBacklight = this.BackColor;
                    ColorFillBK = GetDarkerColor(this.BackColor, 85);
                   ColorBorder = GetDarkerColor(this.BackColor, 100);
                    break;
            }
            Color ColorBacklightEnd = Color.FromArgb(50, 0, 0, 0);
            Color ColorGlowStart = Color.FromArgb(nAlphaEnd, 255, 255, 255);
            Color ColorGlowEnd = Color.FromArgb(nAlphaStart, 255, 255, 255);
            // Create gradient path
            RectangleF er = new RectangleF(rectBar.Left - (rectBar.Width), rectBar.Top - (rectBar.Height / 2), rectBar.Width * 3, rectBar.Height * 4);
            GraphicsPath rctPath = new GraphicsPath();
            rctPath.AddEllipse(er);
            // Create gradient
            PathGradientBrush pgr = new PathGradientBrush(rctPath);
            pgr.CenterPoint = new PointF(rectBar.Width / 2, rectBar.Height);
            pgr.CenterColor = ColorBacklight;
            pgr.SurroundColors = new Color[] { ColorBacklightEnd };
            // Create glow
            GraphicsPath rectBarPath = CreateRoundedPath(rectBar.X, rectBar.Y, rectBar.Width - 1, rectBar.Height - 1, _radius, RectangleCorners.All);
            GraphicsPath rectBarPathHalf = CreateRoundedPath(rectBar.X, rectBar.Y, rectBar.Width - 1, (rectBar.Height - 1) / 2, _radius, RectangleCorners.TopRight | RectangleCorners.TopLeft);
            Rectangle rectGlow = new Rectangle(rectBar.Left, rectBar.Top, rectBar.Width, rectBar.Height / 2);
            LinearGradientBrush brGlow = new LinearGradientBrush(
                new PointF(rectGlow.Left, rectGlow.Height + 1), new PointF(rectGlow.Left, rectGlow.Top - 1),
                ColorGlowStart, ColorGlowEnd);
            // Draw the button
            gr.FillRectangle(new SolidBrush(this.Parent.BackColor), rectBar);
            gr.FillPath(new SolidBrush(ColorFillBK), rectBarPath);
            gr.FillPath(pgr, rectBarPath);
            gr.FillPath(brGlow, rectBarPathHalf);
            gr.DrawPath(new Pen(ColorBorder, 1), rectBarPath);
            StringFormat stringFormat = new StringFormat();
            switch (this.TextAlign)
            {
                case ContentAlignment.TopLeft:
                    stringFormat.Alignment = StringAlignment.Near;
                    stringFormat.LineAlignment = StringAlignment.Near;
                    break;
                case ContentAlignment.TopCenter:
                    stringFormat.Alignment = StringAlignment.Center;
                    stringFormat.LineAlignment = StringAlignment.Near;
                    break;
                case ContentAlignment.TopRight:
                    stringFormat.Alignment = StringAlignment.Far;
                    stringFormat.LineAlignment = StringAlignment.Near;
                    break;
                case ContentAlignment.MiddleLeft:
                    stringFormat.Alignment = StringAlignment.Near;
                    stringFormat.LineAlignment = StringAlignment.Center;
                    break;
                case ContentAlignment.MiddleCenter:
                    stringFormat.Alignment = StringAlignment.Center;
                    stringFormat.LineAlignment = StringAlignment.Center;
                    break;
                case ContentAlignment.MiddleRight:
                    stringFormat.Alignment = StringAlignment.Far;
                    stringFormat.LineAlignment = StringAlignment.Center;
                    break;
                case ContentAlignment.BottomLeft:
                    stringFormat.Alignment = StringAlignment.Near;
                    stringFormat.LineAlignment = StringAlignment.Far;
                    break;
                case ContentAlignment.BottomCenter:
                    stringFormat.Alignment = StringAlignment.Center;
                    stringFormat.LineAlignment = StringAlignment.Far;
                    break;
                case ContentAlignment.BottomRight:
                    stringFormat.Alignment = StringAlignment.Far;
                    stringFormat.LineAlignment = StringAlignment.Far;
                    break;
            }
            SolidBrush drawBrush = new SolidBrush(this.ForeColor);
            if (_antialias)
                gr.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
            gr.DrawString(this.Text, this.Font, drawBrush, rectBar, stringFormat);
        }
        private Color GetDarkerColor(Color color, byte intensity)
        {
            int r, g, b;
            r = color.R - intensity;
            g = color.G - intensity;
            b = color.B - intensity;
            if (r > 255 || r < 0) r *= -1;
            if (g > 255 || g < 0) g *= -1;
            if (b > 255 || b < 0) b *= -1;
            return Color.FromArgb(255, (byte)r, (byte)g, (byte)b);
        }
        private Color GetLighterColor(Color color, byte intensity)
        {
            int r, g, b;
            r = color.R + intensity;
            g = color.G + intensity;
            b = color.B + intensity;
            if (r > 255 || r < 0) r *= -1;
            if (g > 255 || g < 0) g *= -1;
            if (b > 255 || b < 0) b *= -1;
            return Color.FromArgb(255, (byte)r, (byte)g, (byte)b);
        }
        private GraphicsPath CreateRoundedPath(int x, int y, int width, int height, int radius, RectangleCorners corners)
        {
            int xw = x + width - 1;
            int yh = y + height - 1;
            int xwr = xw - radius;
            int yhr = yh - radius;
            int xr = x + radius;
            int yr = y + radius;
            int r2 = radius * 2;
            int xwr2 = xw - r2;
            int yhr2 = yh - r2;
            GraphicsPath p = new GraphicsPath();
            p.StartFigure();
            //Top Left Corner
            if ((RectangleCorners.TopLeft & corners) == RectangleCorners.TopLeft)
            {
                p.AddArc(x, y, r2, r2, 180, 90);
            }
            else
            {
                p.AddLine(x, yr, x, y);
                p.AddLine(x, y, xr, y);
            }
            //Top Edge
            p.AddLine(xr, y, xwr, y);
            //Top Right Corner
            if ((RectangleCorners.TopRight & corners) == RectangleCorners.TopRight)
            {
                p.AddArc(xwr2, y, r2, r2, 270, 90);
            }
            else
            {
                p.AddLine(xwr, y, xw, y);
                p.AddLine(xw, y, xw, yr);
            }
            //Right Edge
            p.AddLine(xw, yr, xw, yhr);
            //Bottom Right Corner
            if ((RectangleCorners.BottomRight & corners) == RectangleCorners.BottomRight)
            {
                p.AddArc(xwr2, yhr2, r2, r2, 0, 90);
            }
            else
            {
                p.AddLine(xw, yhr, xw, yh);
                p.AddLine(xw, yh, xwr, yh);
            }
            //Bottom Edge
            p.AddLine(xwr, yh, xr, yh);
            //Bottom Left Corner
            if ((RectangleCorners.BottomLeft & corners) == RectangleCorners.BottomLeft)
            {
                p.AddArc(x, yhr2, r2, r2, 90, 90);
            }
            else
            {
                p.AddLine(xr, yh, x, yh);
                p.AddLine(x, yh, x, yhr);
            }
            //Left Edge
            p.AddLine(x, yhr, x, yr);
            p.CloseFigure();
            return p;
        }
    }
}

Progressbar like Google Chrom



private void PaintProgress(PaintEventArgs e)
{
  using( SolidBrush progressBrush = new SolidBrush(this.ProgressColor))
  {
      Rectangle rect = LayoutInternal.ProgressRectangle;
      rect.Inflate(-2, -2);
      rect.Height -= 2; rect.Width -= 2;
      float startAngle = -90;
      float sweepAngle = Progress / 100 * 360;
      e.Graphics.FillPie(progressBrush, rect, startAngle, sweepAngle);
  }
}
//----------------------------------------------------------------
private void PaintBorder(PaintEventArgs e)
{
   GraphicsPath borderPath = new GraphicsPath();
   Rectangle progressRect = LayoutInternal.ProgressRectangle;
   borderPath.AddArc(progressRect, 0, 360);
   ....
   ....
   ....
   using (Pen borderPen = new Pen(this.BorderColor, 2))
   {
       e.Graphics.DrawPath(borderPen, borderPath);
       e.Graphics.DrawLine(borderPen,
           new Point(progressRect.Left + progressRect.Width / 2, progressRect.Top),
           new Point(progressRect.Left + progressRect.Width / 2, progressRect.Bottom));
       e.Graphics.DrawLine(borderPen,
           new Point(progressRect.Left, progressRect.Top + progressRect.Height / 2),
           new Point(progressRect.Right, progressRect.Top + progressRect.Height / 2));
       e.Graphics.DrawLine(borderPen,
            new Point(progressRect.Left ,progressRect.Top),
            new Point(progressRect.Right,progressRect.Bottom));
       e.Graphics.DrawLine(borderPen,
           new Point(progressRect.Left, progressRect.Bottom),
           new Point(progressRect.Right, progressRect.Top ));
   }
   e.Graphics.Clip = clip;
}

Progresbar like Vist




private void ProgressBar_Paint(object sender, PaintEventArgs e)
{
 e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
 e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
 DrawBackground(e.Graphics);
 DrawBackgroundShadows(e.Graphics);
 DrawBar(e.Graphics);
 DrawBarShadows(e.Graphics);
 DrawHighlight(e.Graphics);
 DrawInnerStroke(e.Graphics);
 DrawGlow(e.Graphics);

 DrawOuterStroke(e.Graphics);
}
//----------------------------------------------------------------------
private void DrawBackground(Graphics g)
{
 Rectangle r = this.ClientRectangle; r.Width--; r.Height--;
 GraphicsPath rr = RoundRect(r, 2, 2, 2, 2);
 g.FillPath(new SolidBrush(this.BackgroundColor), rr);
}
//----------------------------------------------------------------------
private void DrawBackgroundShadows(Graphics g)
{
 Rectangle lr = new Rectangle(2, 2, 10, this.Height - 5);
 LinearGradientBrush lg = new LinearGradientBrush
                          (lr, Color.FromArgb(30, 0, 0, 0),
                          Color.Transparent,
                          LinearGradientMode.Horizontal);
 lr.X--;
 g.FillRectangle(lg, lr);
 Rectangle rr = new Rectangle(this.Width - 12, 2, 10, this.Height - 5);
 LinearGradientBrush rg = new LinearGradientBrush(rr, Color.Transparent,
                          Color.FromArgb(20, 0, 0, 0),
                          LinearGradientMode.Horizontal);
 g.FillRectangle(rg, rr);
}
//----------------------------------------------------------------------
private void DrawBar(Graphics g)
{
 Rectangle r = new Rectangle(1, 2, this.Width - 3, this.Height - 3);
 r.Width = (int)(Value * 1.0F / (MaxValue - MinValue) * this.Width);
 g.FillRectangle(new SolidBrush(GetIntermediateColor()), r);
}
//----------------------------------------------------------------------
private void DrawBarShadows(Graphics g)
{
 Rectangle lr = new Rectangle(1, 2, 15, this.Height - 3);
 LinearGradientBrush lg = new LinearGradientBrush
                     (lr, Color.White, Color.White,
                          LinearGradientMode.Horizontal);
 ColorBlend lc = new ColorBlend(3);
 lc.Colors = new Color[]
 {Color.Transparent, Color.FromArgb(40, 0, 0, 0), Color.Transparent};
 lc.Positions = new float[] {0.0F, 0.2F, 1.0F};
 lg.InterpolationColors = lc;
 lr.X--;
 g.FillRectangle(lg, lr);
 Rectangle rr = new Rectangle(this.Width - 3, 2, 15, this.Height - 3);
 rr.X = (int)(Value * 1.0F / (MaxValue - MinValue) * this.Width) - 14;
 LinearGradientBrush rg =
     new LinearGradientBrush(rr, Color.Black,Color.Black,
                          LinearGradientMode.Horizontal);
 ColorBlend rc = new ColorBlend(3);
 rc.Colors = new Color[]
 {Color.Transparent, Color.FromArgb(40, 0, 0, 0), Color.Transparent};
 rc.Positions = new float[] {0.0F, 0.8F, 1.0F};
 rg.InterpolationColors = rc;
 g.FillRectangle(rg, rr);
}
//----------------------------------------------------------------------
private void DrawHighlight(Graphics g)
{
 Rectangle tr = new Rectangle(1, 1, this.Width - 1, 6);
 GraphicsPath tp = RoundRect(tr, 2, 2, 0, 0);
 g.SetClip(tp);
 LinearGradientBrush tg = new LinearGradientBrush(tr, Color.White,
                          Color.FromArgb(128, Color.White),
                          LinearGradientMode.Vertical);
 g.FillPath(tg, tp);
 g.ResetClip();
 Rectangle br = new Rectangle(1, this.Height - 8, this.Width - 1, 6);
 GraphicsPath bp = RoundRect(br, 0, 0, 2, 2);
 g.SetClip(bp);
 LinearGradientBrush bg = new LinearGradientBrush(br, Color.Transparent,
                          Color.FromArgb(100, this.HighlightColor),
                          LinearGradientMode.Vertical);
 g.FillPath(bg, bp);
 g.ResetClip();
}
//----------------------------------------------------------------------
private void DrawInnerStroke(Graphics g)
{
 Rectangle r = this.ClientRectangle;
 r.X++; r.Y++; r.Width-=3; r.Height-=3;
 GraphicsPath rr = RoundRect(r, 2, 2, 2, 2);
 g.DrawPath(new Pen(Color.FromArgb(100, Color.White)), rr);
}
//----------------------------------------------------------------------
private void DrawGlow(Graphics g)
{
 Rectangle r = new Rectangle(mGlowPosition, 0, 60, this.Height);
 LinearGradientBrush lgb = new LinearGradientBrush
                       (r, Color.White, Color.White,
                           LinearGradientMode.Horizontal);
 ColorBlend cb = new ColorBlend(4);
 cb.Colors = new Color[]
 {Color.Transparent, this.GlowColor, this.GlowColor, Color.Transparent};
 cb.Positions = new float[] {0.0F, 0.5F, 0.6F, 1.0F};
 lgb.InterpolationColors = cb;
 Rectangle clip = new Rectangle(1, 2, this.Width - 3, this.Height - 3);
 clip.Width = (int)(Value * 1.0F / (MaxValue - MinValue) * this.Width);
 g.SetClip(clip);
 g.FillRectangle(lgb,r);
 g.ResetClip();
}
//----------------------------------------------------------------------
private void DrawOuterStroke(Graphics g)
{
 Rectangle r = this.ClientRectangle; r.Width--; r.Height--;
 GraphicsPath rr = RoundRect(r, 2, 2, 2, 2);
 g.DrawPath(new Pen(Color.FromArgb(178, 178, 178)), rr);
}

Make any image gray style



public static Bitmap MakeGrayscale(Bitmap original)
{
  //make an empty bitmap the same size as original
  Bitmap newBitmap = new Bitmap(original.Width, original.Height);
  for (int i = 0; i < original.Width; i++)
  {
      for (int j = 0; j < original.Height; j++)
      {
          //get the pixel from the original image
          Color originalColor = original.GetPixel(i, j);
          //create the grayscale version of the pixel
          int grayScale = (int)((originalColor.R * .3) + (originalColor.G * .59)
              + (originalColor.B * .11));
          //create the color object
          Color newColor = Color.FromArgb(grayScale, grayScale, grayScale);
          //set the new image's pixel to the grayscale version
          newBitmap.SetPixel(i, j, newColor);
      }
  }
  return newBitmap;
}

Get Image of Open Form



//necessary function to create bitmap of form
        [DllImport("user32.dll", ExactSpelling = true, SetLastError = true)]
        public static extern IntPtr GetDC(IntPtr hWnd);
        [DllImport("user32.dll", ExactSpelling = true)]
        public static extern IntPtr ReleaseDC(IntPtr hWnd, IntPtr hDC);
        [DllImport("gdi32.dll", ExactSpelling = true)]
        public static extern IntPtr BitBlt(IntPtr hDestDC, int x, int y,
             int nWidth, int nHeight, IntPtr hSrcDC,
             int xSrc, int ySrc, int dwRop);
        public static Bitmap GetFormImage(System.Windows.Forms.Form frm)
        {
            Graphics g = frm.CreateGraphics();
            Size s = frm.Size;
            Bitmap formImage = new Bitmap(s.Width, s.Height, g);
            Graphics mg = Graphics.FromImage(formImage);
            IntPtr dc1 = g.GetHdc();
            IntPtr dc2 = mg.GetHdc();
            BitBlt(dc2, 0, 0, frm.ClientRectangle.Width, frm.ClientRectangle.Height, dc1, 0, 0, 13369376);
            g.ReleaseHdc(dc1);
            mg.ReleaseHdc(dc2);
            return formImage;
        }