Results 1 to 1 of 1

Thread: Outlook 2003 Like Headers

  1. #1

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Cool Outlook 2003 Like Headers

    This is a very simple class that inherits the System.Windows.Forms.Label. basically, its background looks just like Outlook 2003's headers with the Luna theme.

    I know we should make it so our App follows a system's theme, and can be easily modified to do so, I just like the blue look

    Anyway, here is the class:

    VB Code:
    1. public class OutlookLikeHeader : Label
    2.     {
    3.         public OutlookLikeHeader()
    4.         {
    5.             this.ForeColor = Color.White;
    6.             this.Font = new Font("Arial", 14.25f, FontStyle.Bold);
    7.             this.AutoSize = false;
    8.         }
    9.         protected override void OnResize(EventArgs e)
    10.         {
    11.             base.OnResize(e);
    12.         }
    13.         protected override void OnPaint(PaintEventArgs e)
    14.         {
    15.             using (Brush b = new SolidBrush(this.ForeColor))
    16.             {
    17.                 e.Graphics.DrawString(this.Text, this.Font, b, e.ClipRectangle.X, e.ClipRectangle.Y);
    18.             }
    19.         }
    20.         protected override void OnPaintBackground(PaintEventArgs pevent)
    21.         {
    22.             this.Height = Convert.ToInt32(pevent.Graphics.MeasureString(this.Text, this.Font).Height)+ 5;
    23.             using (Brush b = new LinearGradientBrush(this.ClientRectangle, Color.FromArgb(88, 133, 214), Color.FromArgb(15, 55, 154), LinearGradientMode.Vertical))
    24.             {
    25.                 pevent.Graphics.FillRectangle(b, this.ClientRectangle);
    26.             }
    27.         }
    28.     }

    Attached is what it looks like. It's very basic code but I thought it may help someone.
    Attached Images Attached Images  
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width