Click here to Skip to main content
Click here to Skip to main content

MBGlassPanel Using VB.NET 2008

, 9 Jul 2012
Rate this:
Please Sign up or sign in to vote.
MBGlassPanel with Microsoft Office Ribbon Visual Style

Introduction

Why another Panel? This is a User Control with Microsoft Office Ribbon Visual Style. It is simple to use, just drop it on the form, and use it like the normal Panel.

Background

MBPanel is a Panel which inherits all the properties of simple Panel control. I added Microsoft Office Ribbon like Visuals in MBPanel. The language used is VB.NET. To Use this Control in your Application or Project You Just add the reference of MBPanel.Dll and used it by Dragging and Dropping.

Using the code

The concept for this MBPanel came from the Microsoft Office Ribbon Panel. I organized methods of MBPanel into layers like this:

Following methods which are responsible for rendering simple Panel like Microsoft office Ribbon Panel. This method Render Background of MBPanel:

''' <summary>
''' Paint Backround Surface Of MBPanel
''' </summary />
Private Sub PaintBackgoundSurface(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs)
     With e.Graphics
           .SmoothingMode = SmoothingMode.HighQuality
           .TextRenderingHint = Drawing.Text.TextRenderingHint.AntiAlias
           .CompositingQuality = CompositingQuality.HighQuality
     End With
     Dim brGlass As New SolidBrush(Color.FromArgb(CheckOpacity(Opacity), _
                    GlassColor.R, GlassColor.G, GlassColor.B))
     e.Graphics.FillPath(brGlass, RoundSurface)
     PaintHorizontalSurface(sender, e)
     PaintGlowSurface(sender, e)
     PaintReflectiveBands(sender, e)
     PaintLightSource(sender, e)
End Sub

This method Paint Reflective Bands for MBPanel:

 ''' <summary>
''' Paint ReflectiveBands for MBPanel
''' </summary />
Private Sub PaintReflectiveBands(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs)
    Dim brGlassReflect As New SolidBrush(Color.FromArgb(CheckOpacity(Opacity * 0.5), GlassColor.R, GlassColor.G, GlassColor.B))
    Dim grpBand1 As GraphicsPath = CreateReflectiveBand(0.1!, 0.5!, 0.15!)
    Dim grpBand2 As GraphicsPath = CreateReflectiveBand(0.4!, 0.8!, 0.1!)
    e.Graphics.FillPath(brGlassReflect, grpBand1)
    e.Graphics.FillPath(brGlassReflect, grpBand2)
End Sub 

This method Paint Reflective Bands for MBPanel:

''' <summary>
''' Paint ReflectiveBands for MBPanel
''' </summary />
Private Sub PaintReflectiveBands(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs)
    Dim brGlassReflect As New SolidBrush(Color.FromArgb(CheckOpacity(Opacity * 0.5), GlassColor.R, GlassColor.G, GlassColor.B))
    Dim grpBand1 As GraphicsPath = CreateReflectiveBand(0.1!, 0.5!, 0.15!)
    Dim grpBand2 As GraphicsPath = CreateReflectiveBand(0.4!, 0.8!, 0.1!)
    e.Graphics.FillPath(brGlassReflect, grpBand1)
    e.Graphics.FillPath(brGlassReflect, grpBand2)
End Sub

This method Paint Border for MBPanel:

''' <summary>
''' Paint Border of MBPanel
''' </summary />
Private Sub PaintBorder(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs)
    If _BorderStyle = MBBorderStyle.Rounded Then
        e.Graphics.DrawPath(New Pen(Color.FromArgb(200, 255, 255, 255), 0.5!), RoundSurface)
        e.Graphics.DrawPath(New Pen(Color.FromArgb(255, 0, 0, 0), 0.5!), RoundSurfaceInner)
    End If
End Sub

How to use

It is very easy to use the MBPanel in your application. Just add the reference of the provided DLL to your application and just drag and drop.

History

  • MBPanel Version 1.0.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Manoj K Bhoir
Software Developer
India India
It always seems good to hear about me, but the thing I do is I code. I'm Interested in Designing Windows Based Application, Web Applications and building Mobile Applications. Currently restricting it to Android 4.0 applications, building Internet Based Applications using ASP.NET and contributing to bring the student community to a position which will help technology to reach the greatest heights ever. A very Big fan of Microsoft & Android..!!
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

 
GeneralMy vote of 4 Pinmemberrspercy659-Jul-12 13:07 
GeneralThis has already been done Pinmemberrspercy659-Jul-12 13:02 
GeneralMy vote of 1 PinmvpDave Kreskowiak9-Jul-12 12:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web04 | 2.8.140821.2 | Last Updated 9 Jul 2012
Article Copyright 2012 by Manoj K Bhoir
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid