コード例 #1
0
        public override void Paint(QatCustomizeItemRendererEventArgs e)
        {
            Graphics g = e.Graphics;
            QatCustomizeItem item = e.CustomizeItem;
            Rectangle r = item.DisplayRectangle;
            Region oldClip = null;
            if (g.Clip != null) oldClip = g.Clip 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;

            if(item.EffectiveStyle == eDotNetBarStyle.Metro)
                Office2007ButtonItemPainter.PaintBackground(g, state, r, RoundRectangleShapeDescriptor.RectangleShape);
            else
                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(4, 0), b));
            shape.Children.Add(new Presentation.Line(new Presentation.Location(0, 1), new Presentation.Location(4, 1), bl));

            shape.Children.Add(new Presentation.Line(new Presentation.Location(0, 3), new Presentation.Location(4, 3), b));
            shape.Children.Add(new Presentation.Line(new Presentation.Location(4, 3), new Presentation.Location(2, 5), b));
            shape.Children.Add(new Presentation.Line(new Presentation.Location(2, 5), new Presentation.Location(0, 3), b));
            shape.Children.Add(new Presentation.Line(new Presentation.Location(1, 4), new Presentation.Location(3, 4), b));
            shape.Children.Add(new Presentation.Line(new Presentation.Location(4, 4), new Presentation.Location(2, 6), bl));
            shape.Children.Add(new Presentation.Line(new Presentation.Location(2, 6), new Presentation.Location(0, 4), bl));

            Rectangle sr = new Rectangle(r.X + (r.Width - 5) / 2, r.Y + (r.Height - 7) / 2, 5, 7);
            Presentation.ShapePaintInfo pi = new Presentation.ShapePaintInfo(g, sr);
            shape.Paint(pi);

            g.SmoothingMode = sm;

            if (oldClip != null)
            {
                g.Clip = oldClip;
                oldClip.Dispose();
            }
            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 DrawQatCustomizeItem(QatCustomizeItemRendererEventArgs e)
        {
            QatCustomizeItemPainter painter = PainterFactory.CreateQatCustomizeItemPainter(e.CustomizeItem);

            if (painter == null)
                return;

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

            painter.Paint(e);

            base.DrawQatCustomizeItem(e);
        }
コード例 #3
0
 public abstract void Paint(QatCustomizeItemRendererEventArgs e);
コード例 #4
0
 /// <summary>
 /// Draws the Quick Access Toolbar Customize 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 OnRenderQatCustomizeItem method so events can occur.
 /// </summary>
 /// <param name="e">Provides context information.</param>
 public virtual void DrawQatCustomizeItem(QatCustomizeItemRendererEventArgs e)
 {
     OnRenderQatCustomizeItem(e);
 }
コード例 #5
0
 /// <summary>
 /// Raises RenderQatCustomizeItem event.
 /// </summary>
 /// <param name="e">Provides context information.</param>
 protected virtual void OnRenderQatCustomizeItem(QatCustomizeItemRendererEventArgs e)
 {
     if (RenderQatCustomizeItem != null)
         RenderQatCustomizeItem(this, e);
 }