예제 #1
0
        /// <summary>
        /// Draws the SideBar control. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
        /// do not want default rendering to occur do not call the base implementation. You can call OnRenderSideBarPanelItem method so events can occur.
        /// </summary>
        /// <param name="e">Provides context information.</param>
        public override void DrawSideBarPanelItem(SideBarPanelItemRendererEventArgs e)
        {
            SideBarPainter painter = PainterFactory.CreateSideBarPainter();

            if (painter == null)
                return;

            if (painter is IOffice2007Painter)
                ((IOffice2007Painter)painter).ColorTable = m_ColorTable;

            painter.PaintSideBarPanelItem(e);

            base.DrawSideBarPanelItem(e);
        }
예제 #2
0
 public virtual void PaintSideBarPanelItem(SideBarPanelItemRendererEventArgs e) { }
예제 #3
0
 /// <summary>
 /// Raises RenderSideBarPanelItem event.
 /// </summary>
 /// <param name="e">Provides context information.</param>
 protected virtual void OnRenderSideBarPanelItem(SideBarPanelItemRendererEventArgs e)
 {
     if (RenderSideBarPanelItem != null)
         RenderSideBarPanelItem(this, e);
 }
예제 #4
0
 /// <summary>
 /// Draws the SideBar control. If you need to provide custom rendering this is the method that you should override in your custom rendered. If you
 /// do not want default rendering to occur do not call the base implementation. You can call OnRenderSideBarPanelItem method so events can occur.
 /// </summary>
 /// <param name="e">Provides context information.</param>
 public virtual void DrawSideBarPanelItem(SideBarPanelItemRendererEventArgs e)
 {
     OnRenderSideBarPanelItem(e);
 }
예제 #5
0
        public override void PaintSideBarPanelItem(SideBarPanelItemRendererEventArgs e)
        {
            Graphics g = e.Graphics;
            SideBarPanelItem sb = e.SideBarPanelItem;
            Office2007SideBarColorTable ct = m_ColorTable.SideBar;
            GradientColorTable stateColorTable = sb.Expanded ? ct.SideBarPanelItemExpanded : ct.SideBarPanelItemDefault;
            if (sb.IsMouseDown)
                stateColorTable = ct.SideBarPanelItemPressed;
            else if (sb.IsMouseOver)
                stateColorTable = ct.SideBarPanelItemMouseOver;

            if (!sb.BackgroundStyle.BackColor1.IsEmpty || sb.BackgroundStyle.BackgroundImage != null)
                sb.BackgroundStyle.Paint(g, sb.DisplayRectangle);

            Rectangle r = sb.PanelRect;
            Rectangle bounds = sb.DisplayRectangle;
            r.Offset(bounds.Location);

            if (stateColorTable != null)
            {
                using (Brush brush = DisplayHelp.CreateBrush(r, stateColorTable))
                {
                    g.FillRectangle(brush, r);
                }
            }

            if (sb.Expanded)
            {
                DisplayHelp.DrawLine(g, r.X, r.Bottom, r.Right, r.Bottom, ct.Border, 1);
            }

            DisplayHelp.DrawLine(g, bounds.X, bounds.Bottom, bounds.Right, bounds.Bottom, ct.Border, 1);

            Font font = sb.GetFont();
            CompositeImage image = sb.GetImage();

            if (image != null)
            {
                r.X += 2;
                r.Width -= 2;
                image.DrawImage(g, new Rectangle(r.X, r.Y + (r.Height - image.Height) / 2, image.Width, image.Height));
                r.X += (image.Width + 4);
                r.Width -= (image.Width + 8);
            }

            Rectangle rText = Rectangle.Empty;
            if (sb.Text.Length > 0)
            {
                Color textColor = ct.SideBarPanelItemText;
                if (!sb.ForeColor.IsEmpty) textColor = sb.ForeColor;
                if (sb.IsMouseOver && !sb.HotForeColor.IsEmpty) textColor = sb.HotForeColor;
                TextDrawing.DrawString(g, sb.Text, font, textColor, r, sb.GetStringFormat());
                rText = r;
            }

            if (sb.Focused)
            {
                if (sb.DesignMode)
                {
                    Rectangle rFocus = sb.PanelRect;
                    rFocus.Offset(sb.DisplayRectangle.Location);
                    rFocus.Inflate(-2, -2);
                    DesignTime.DrawDesignTimeSelection(g, rFocus, e.ItemPaintArgs.Colors.ItemDesignTimeBorder);
                }
                else if (!rText.IsEmpty)
                {
                    System.Windows.Forms.ControlPaint.DrawFocusRectangle(g, rText);
                }
            }

            base.PaintSideBarPanelItem(e);
        }