Divelements Community
Customer discussion of all Divelements products

SandBar Office 2007 improved renderer

Latest post 08-16-2007 23:33 by Manel. 0 replies.
  • 08-16-2007 23:33

    • Manel
    • Top 500 Contributor
    • Joined on 09-23-2006
    • Posts 5

    SandBar Office 2007 improved renderer

        Hello,
    I've just made some changes to the office2007 renderer to display selected menu items like in office 2007.

    That's how it looks when combined with the SandDock Office 2007 renderer:

    http://www.blide.org/images/snapshot1.gif


    Here's the source code in Visual Basic:

    --------------------------------------------------------------------------
    Class BlideBarRenderer
        Inherits td.SandBar.Office2007Renderer
        Public Overrides Sub DrawMenuItemHighlight(ByVal graphics As System.Drawing.Graphics, ByVal item As td.SandBar.MenuButtonItem, ByVal bounds As System.Drawing.Rectangle)
            Dim x1 As Integer = bounds.X
            Dim x2 As Integer = bounds.X + bounds.Width
            Dim y1 As Integer = bounds.Y
            Dim y2 As Integer = bounds.Y + bounds.Height
            graphics.FillRectangle(New SolidBrush(Color.FromArgb(255, 255, 220, 116)), x1 + 1, CInt(y1 + bounds.Height / 2), bounds.Width - 1, CInt((bounds.Height - 1) / 2) + 1)
            graphics.FillRectangle(New SolidBrush(Color.FromArgb(255, 255, 248, 213)), x1 + 1, y1, bounds.Width - 1, CInt((bounds.Height - 1) / 2) + 1)
            Dim s As Integer = 0
            For i As Integer = CInt(y1 + bounds.Height / 2) + 1 To CInt(y1 + bounds.Height / 2) - 1 Step -1
                graphics.DrawLine(New Pen(Color.FromArgb(255 - s, 255, 220, 116)), x1, i, x2, i)
                s = s + 50
            Next
            Dim p As New Pen(Color.FromArgb(255, 208, 189, 152))
            graphics.DrawLine(p, x1 + 1, y1, x2 - 1, y1)
            graphics.DrawLine(p, x1, y1 + 1, x1, y2 - 2)
            graphics.DrawLine(p, x1 + 1, y2, x2 - 1, y2)
            graphics.DrawLine(p, x2, y1 + 1, x2, y2 - 1)
            graphics.DrawLine(p, bounds.X + 1, bounds.Y, bounds.X + bounds.Width - 1, bounds.Y)
        End Sub

        Public Overrides Sub DrawMenuItemCheck(ByVal graphics As System.Drawing.Graphics, ByVal item As td.SandBar.MenuButtonItem, ByVal drawCheckMark As Boolean, ByVal bounds As System.Drawing.Rectangle)
            Dim x1 As Integer = bounds.X
            Dim x2 As Integer = bounds.X + bounds.Width
            Dim y1 As Integer = bounds.Y
            Dim y2 As Integer = bounds.Y + bounds.Height
            graphics.FillRectangle(New SolidBrush(Color.FromArgb(255, 255, 220, 116)), x1 + 1, CInt(y1 + bounds.Height / 2), bounds.Width - 1, CInt((bounds.Height - 1) / 2) + 1)
            graphics.FillRectangle(New SolidBrush(Color.FromArgb(255, 255, 248, 213)), x1 + 1, y1, bounds.Width - 1, CInt((bounds.Height - 1) / 2) + 1)
            Dim s As Integer = 0
            For i As Integer = CInt(y1 + bounds.Height / 2) + 1 To CInt(y1 + bounds.Height / 2) - 1 Step -1
                graphics.DrawLine(New Pen(Color.FromArgb(255 - s, 255, 220, 116)), x1, i, x2, i)
                s = s + 50
            Next
            graphics.FillRectangle(New SolidBrush(Color.FromArgb(20, 255, 255, 255)), x1 + 1, y1 + 1, bounds.Width - 1, bounds.Height - 1)

            Dim p As New Pen(Color.FromArgb(255, 208, 189, 152))
            graphics.DrawLine(p, x1 + 1, y1, x2 - 1, y1)
            graphics.DrawLine(p, x1, y1 + 1, x1, y2 - 2)
            graphics.DrawLine(p, x1 + 1, y2, x2 - 1, y2)
            graphics.DrawLine(p, x2, y1 + 1, x2, y2 - 1)
            graphics.DrawLine(p, bounds.X + 1, bounds.Y, bounds.X + bounds.Width - 1, bounds.Y)
            If item.Image Is Nothing Then
                Dim f As Font = New Font("Marlett", 16)
                Dim Size As System.Drawing.SizeF = graphics.MeasureString("a", f)
                graphics.DrawString("a", f, New SolidBrush(Color.FromArgb(255, 120, 120, 120)), x1 + bounds.Width / 2 - Size.Width / 2, y1 + bounds.Height / 2 - Size.Height / 2)
            End If
        End Sub
    End Class


    ----------------------------------------------------------------
    Feel free to use it :D
Page 1 of 1 (1 items) | RSS
Copyright © 2008 Divelements Limited
Powered by Community Server (Commercial Edition), by Telligent Systems