Ejemplo n.º 1
0
        public override void PaintDialogLauncher(RibbonBarRendererEventArgs e)
        {
            Rectangle r = e.Bounds;
            Graphics g = e.Graphics;
            bool rightToLeft = (e.RibbonBar.RightToLeft == System.Windows.Forms.RightToLeft.Yes);
            Office2007DialogLauncherStateColorTable c = GetColorTable(e);

            if (!c.TopBackground.IsEmpty && !c.BottomBackground.IsEmpty)
            {
                Presentation.Rectangle pr = new Presentation.Rectangle(
                    new Presentation.ShapeBorder(c.OuterBorder), new Presentation.ShapeFill(c.TopBackground));
                pr.Padding = new Presentation.PaddingInfo(1, 1, 1, 1);
                Presentation.Rectangle prb = new Presentation.Rectangle(new Presentation.ShapeFill(c.BottomBackground));
                prb.Size.Height = r.Height / 2;
                pr.Children.Add(prb);
                prb = new Presentation.Rectangle(new Presentation.ShapeBorder(c.InnerBorder));
                pr.Children.Add(prb);
                Presentation.ShapePaintInfo pi = new Presentation.ShapePaintInfo(g, r);
                pr.Paint(pi);
            }

            Size size = new Size(8, 8);

            // Get final dialog launcher bounds
            if (rightToLeft)
                r = new Rectangle(r.X + (r.Width - size.Width) / 2, r.Y + (r.Height - size.Height) / 2, size.Width, size.Height);
            else
                r = new Rectangle(r.X + (r.Width - size.Width)/2, r.Y + (r.Height - size.Height) / 2, size.Width, size.Height);

            SmoothingMode sm = g.SmoothingMode;
            g.SmoothingMode = SmoothingMode.Default;
            
            // Create the dialog launcher shape
            Presentation.ShapeBorder border = new Presentation.ShapeBorder(c.DialogLauncherShade, 1);
            Presentation.ShapeFill fill = new Presentation.ShapeFill(c.DialogLauncherShade);
            Presentation.Shape shape = new Presentation.Shape();

            // Horizontal line
            Presentation.Line line = new Presentation.Line(new Presentation.Location(),
                new Presentation.Location(6, 0), border);
            shape.Children.Add(line);

            // Vertical line
            line = new Presentation.Line(new Presentation.Location(),
                new Presentation.Location(0, 6), border);
            shape.Children.Add(line);

            Presentation.Rectangle rect = new Presentation.Rectangle();
            rect.Fill = fill;
            rect.Location.X = 5;
            rect.Location.Y = 5;
            rect.Size.Width = 3;
            rect.Size.Height = 3;
            shape.Children.Add(rect);

            // Arrow line vertical
            line = new Presentation.Line(new Presentation.Location(7, 4),
                new Presentation.Location(7, 7), border);
            shape.Children.Add(line);
            // Arrow line horizontal
            line = new Presentation.Line(new Presentation.Location(4, 7),
                new Presentation.Location(7, 7), border);
            shape.Children.Add(line);
            // Arrow line cross
            line = new Presentation.Line(new Presentation.Location(4, 4),
                new Presentation.Location(5, 5), border);
            shape.Children.Add(line);

            r.Offset(1, 1);
            Presentation.ShapePaintInfo p = new Presentation.ShapePaintInfo(g, r);
            shape.Paint(p);

            border.Color1 = c.DialogLauncher;
            fill.Color1 = c.DialogLauncher;
            r.Offset(-1, -1);
            p.Bounds = r;
            shape.Paint(p);

            g.SmoothingMode = sm;
        }
Ejemplo n.º 2
0
		private void PaintDialogLauncher(ItemPaintArgs pa)
		{
			Rectangle r=new Rectangle(m_TitleRectangle.Right-(m_TitleRectangle.Height-5)-3,m_TitleRectangle.Y+2,
                m_TitleRectangle.Height-5,m_TitleRectangle.Height-5);
            if (this.RightToLeft == RightToLeft.Yes)
                r.X = m_TitleRectangle.X;
			Graphics g=pa.Graphics;

            if (BarFunctions.IsOffice2007Style(this.EffectiveStyle))
            {
                int ds = (int)Math.Min(15, m_TitleRectangle.Height - 1);
                r = new Rectangle(m_TitleRectangle.Right - ds - 2, m_TitleRectangle.Y + (m_TitleRectangle.Height-ds)/2, ds, ds);
                if (this.RightToLeft == RightToLeft.Yes)
                    r.X = m_TitleRectangle.X+2;

                RibbonBarRendererEventArgs e = new RibbonBarRendererEventArgs(g, r, this);
                if (m_MouseOverDialogLauncher)
                {
                    if (Control.MouseButtons == MouseButtons.Left)
                        e.Pressed = true;
                    else
                        e.MouseOver = true;
                }
                this.GetRenderer().DrawRibbonDialogLauncher(e);
                m_DialogLauncherRect = r;
                return;
            }

			if(this.AntiAlias)
				g.SmoothingMode=System.Drawing.Drawing2D.SmoothingMode.Default; // AntiAlias;

			using(LinearGradientBrush brush=DisplayHelp.CreateLinearGradientBrush(r,ControlPaint.LightLight(pa.Colors.BarBackground),pa.Colors.BarBackground,90))
			{
				g.FillRectangle(brush,r);
			}

			Rectangle rDot=new Rectangle(r.X+(int)Math.Ceiling((float)(r.Width-8)/2),r.Bottom-4,2,2);
			g.FillRectangle(SystemBrushes.ControlText,rDot);
			rDot.Offset(rDot.Width+1,0);
			g.FillRectangle(SystemBrushes.ControlText,rDot);
			rDot.Offset(rDot.Width+1,0);
			g.FillRectangle(SystemBrushes.ControlText,rDot);

			if(this.AntiAlias)
				g.SmoothingMode=System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

			m_DialogLauncherRect=r;
		}
Ejemplo n.º 3
0
 private Office2007DialogLauncherStateColorTable GetColorTable(RibbonBarRendererEventArgs e)
 {
     if (e.Pressed)
         return m_ColorTable.DialogLauncher.Pressed;
     else if (e.MouseOver)
         return m_ColorTable.DialogLauncher.MouseOver;
     else
         return m_ColorTable.DialogLauncher.Default;
 }
Ejemplo n.º 4
0
 public abstract void PaintDialogLauncher(RibbonBarRendererEventArgs e);