示例#1
0
        public override void Paint(QatOverflowItemRendererEventArgs e)
        {
            Graphics g = e.Graphics;
            QatOverflowItem item = e.OverflowItem;
            Rectangle r = item.DisplayRectangle;
            Region oldClip = null;
            if(g.Clip!=null) oldClip = g.Clip.Clone() as Region;
            g.SetClip(item.DisplayRectangle, CombineMode.Intersect);

            
            Office2007ButtonItemColorTable buttonColorTable = GetColorTable();
            Office2007ButtonItemStateColorTable state = buttonColorTable.Default;
            
            if (item.Expanded)
                state = buttonColorTable.Expanded;
            else if (item.IsMouseOver)
                state = buttonColorTable.MouseOver;

            Office2007ButtonItemPainter.PaintBackground(g, state, r, RoundRectangleShapeDescriptor.RoundCorner2);

            SmoothingMode sm = g.SmoothingMode;
            g.SmoothingMode = SmoothingMode.Default;

            Color color = state.ExpandBackground;
            Color colorLight = state.ExpandLight;

            Presentation.Shape shape = new Presentation.Shape();
            Presentation.ShapeBorder bl = new Presentation.ShapeBorder(colorLight, 1);
            Presentation.ShapeBorder b = new Presentation.ShapeBorder(color, 1);
            shape.Children.Add(new Presentation.Line(new Presentation.Location(0, 0), new Presentation.Location(2, 2), bl));
            shape.Children.Add(new Presentation.Line(new Presentation.Location(2, 2), new Presentation.Location(0, 4), bl));
            shape.Children.Add(new Presentation.Line(new Presentation.Location(0, 1), new Presentation.Location(1, 2), b));
            shape.Children.Add(new Presentation.Line(new Presentation.Location(1, 2), new Presentation.Location(0, 3), b));
            shape.Children.Add(new Presentation.Line(new Presentation.Location(0, 3), new Presentation.Location(0, 1), b));

            Rectangle sr = new Rectangle(r.X + (r.Width - 5)/2, r.Y + (r.Height - 4) / 2, 3, 6);
            Presentation.ShapePaintInfo pi = new Presentation.ShapePaintInfo(g, sr);
            shape.Paint(pi);
            sr.Offset(4, 0);
            pi.Bounds = sr;
            shape.Paint(pi);
            g.SmoothingMode = sm;

            if (oldClip != null)
                g.Clip = oldClip;
            else
                g.ResetClip();
        }
示例#2
0
        /// <summary>
        /// Draws the Quick Access Toolbar Overflow item. 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 OnRenderQatOverflowItem method so events can occur.
        /// </summary>
        /// <param name="e">Provides context information.</param>
        public override void DrawQatOverflowItem(QatOverflowItemRendererEventArgs e)
        {
            QatOverflowPainter painter = PainterFactory.CreateQatOverflowItemPainter(e.OverflowItem);

            if (painter == null)
                return;

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

            painter.Paint(e);

            base.DrawQatOverflowItem(e);
        }
示例#3
0
 public abstract void Paint(QatOverflowItemRendererEventArgs e);
示例#4
0
 /// <summary>
 /// Draws the Quick Access Toolbar Overflow item. 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 OnRenderQatOverflowItem method so events can occur.
 /// </summary>
 /// <param name="e">Provides context information.</param>
 public virtual void DrawQatOverflowItem(QatOverflowItemRendererEventArgs e)
 {
     OnRenderQatOverflowItem(e);
 }
示例#5
0
 /// <summary>
 /// Raises RenderQatOverflowItem event.
 /// </summary>
 /// <param name="e">Provides context information.</param>
 protected virtual void OnRenderQatOverflowItem(QatOverflowItemRendererEventArgs e)
 {
     if (RenderQatOverflowItem != null)
         RenderQatOverflowItem(this, e);
 }