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
:
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
:
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
:
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
:
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