Beispiel #1
0
        /// <summary>
        /// CustomizedToolTip_Draw raised when tooltip is drawn.
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">e</param>
        void ToolTip_Draw(object sender, DrawToolTipEventArgs e)
        {
            try
            {
                e.Graphics.CompositingQuality = CompositingQuality.HighQuality;
                //Get the tooltip text
                string TipText = base.GetToolTip(e.AssociatedControl);

                RibbonToolTipRenderEventArgs eTip = new RibbonToolTipRenderEventArgs(Owner, e.Graphics, e.Bounds, TipText);
                eTip.Color = Color.Black;
                eTip.Font  = _Font;

                Owner.Renderer.OnRenderToolTipBackground(eTip);
                //e.DrawBackground();

                StringFormat sf = new StringFormat();
                sf.Trimming = StringTrimming.None;
                eTip.Format = sf;

                //draw the image
                if (_ImageRectangle.Width > 0 && _ImageRectangle.Height > 0)
                {
                    //_Owner.Renderer.OnRenderToolTipImage(eTip);
                    e.Graphics.DrawImage(_ToolTipImage, _ImageRectangle);
                }

                //draw the tooltip text
                if (_TextRectangle.Width > 0 && _TextRectangle.Height > 0)
                {
                    sf.Alignment       = StringAlignment.Near;
                    sf.LineAlignment   = StringAlignment.Near;
                    eTip.ClipRectangle = _TextRectangle;
                    eTip.Text          = TipText;
                    Owner.Renderer.OnRenderToolTipText(eTip);
                }

                // Draw the Title
                if (_TitleRectangle.Width > 0 && _TitleRectangle.Height > 0)
                {
                    Font f = new Font(_Font, FontStyle.Bold);
                    eTip.ClipRectangle = _TitleRectangle;
                    eTip.Text          = ToolTipTitle;
                    eTip.Font          = f;
                    Owner.Renderer.OnRenderToolTipText(eTip);
                    f.Dispose();
                }
            }

            catch (Exception ex)
            {
                string logMessage = "Exception in RibbonToolTip_Draw (object, DrawToolTipEventArgs) " + ex.ToString();
                Trace.TraceError(logMessage);
                throw;
            }
        }
        /// <summary>
        /// CustomizedToolTip_Draw raised when tooltip is drawn.
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">e</param>
        void ToolTip_Draw(object sender, DrawToolTipEventArgs e)
        {
            try
            {
                e.Graphics.CompositingQuality = CompositingQuality.HighQuality;
                //Get the tooltip text
                string TipText = base.GetToolTip(e.AssociatedControl);

                RibbonToolTipRenderEventArgs eTip = new RibbonToolTipRenderEventArgs(Owner, e.Graphics, e.Bounds, TipText);
                eTip.Color = Color.Black;
                eTip.Font = _Font;

                Owner.Renderer.OnRenderToolTipBackground(eTip);
                //e.DrawBackground();

                StringFormat sf = new StringFormat();
                sf.Trimming = StringTrimming.None;
                eTip.Format = sf;

                //draw the image
                if (_ImageRectangle.Width > 0 && _ImageRectangle.Height > 0)
                {
                    //_Owner.Renderer.OnRenderToolTipImage(eTip);
                    e.Graphics.DrawImage(_ToolTipImage, _ImageRectangle);
                }

                //draw the tooltip text
                if (_TextRectangle.Width > 0 && _TextRectangle.Height > 0)
                {
                    sf.Alignment = StringAlignment.Near;
                    sf.LineAlignment = StringAlignment.Near;
                    eTip.ClipRectangle = _TextRectangle;
                    eTip.Text = TipText;
                    Owner.Renderer.OnRenderToolTipText(eTip);
                }

                // Draw the Title
                if (_TitleRectangle.Width > 0 && _TitleRectangle.Height > 0)
                {
                    Font f = new Font(_Font, FontStyle.Bold);
                    eTip.ClipRectangle = _TitleRectangle;
                    eTip.Text = ToolTipTitle;
                    eTip.Font = f;
                    Owner.Renderer.OnRenderToolTipText(eTip);
                    f.Dispose();
                }
            }

            catch (Exception ex)
            {
                string logMessage = "Exception in RibbonToolTip_Draw (object, DrawToolTipEventArgs) " + ex.ToString();
                Trace.TraceError(logMessage);
                throw;
            }
        }
Beispiel #3
0
 public virtual void OnRenderToolTipImage(RibbonToolTipRenderEventArgs e)
 {
 }
Beispiel #4
0
 /// <summary>
 /// Call to draw the Tooltip
 /// </summary>
 /// <param name="e"></param>
 public virtual void OnRenderToolTipBackground(RibbonToolTipRenderEventArgs e)
 {
 }
 public override void OnRenderToolTipImage(RibbonToolTipRenderEventArgs e)
 {
     e.Graphics.DrawImage(e.TipImage, e.ClipRectangle);
 }
 public override void OnRenderToolTipText(RibbonToolTipRenderEventArgs e)
 {
     if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2007 || e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2010)
     {
         using (Brush b = new SolidBrush(ColorTable.ToolTipText))
         {
             e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
             e.Graphics.DrawString(e.Text, e.Font, b, e.ClipRectangle, e.Format);
         }
     }
     else if (e.Ribbon.OrbStyle == RibbonOrbStyle.Office_2013)
     {
         using (Brush b = new SolidBrush(ColorTable.ToolTipText_2013))
         {
             e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
             e.Graphics.DrawString(e.Text, e.Font, b, e.ClipRectangle, e.Format);
         }
     }
 }
        public override void OnRenderToolTipBackground(RibbonToolTipRenderEventArgs e)
        {
            Rectangle darkBorder = Rectangle.FromLTRB(
                e.ClipRectangle.Left,
                e.ClipRectangle.Top,
                e.ClipRectangle.Right - 1,
                e.ClipRectangle.Bottom - 1);

            Rectangle lightBorder = Rectangle.FromLTRB(
                e.ClipRectangle.Left + 1,
                e.ClipRectangle.Top + 1,
                e.ClipRectangle.Right - 2,
                e.ClipRectangle.Bottom - 1);

            GraphicsPath dark = RoundRectangle(darkBorder, 3);
            GraphicsPath light = RoundRectangle(lightBorder, 3);

            //Draw the Drop Shadow
            Rectangle shadow = e.ClipRectangle; shadow.Offset(2, 1);
            using (GraphicsPath path = RoundRectangle(shadow, 3, Corners.All))
            {
                using (PathGradientBrush b = new PathGradientBrush(path))
                {
                    b.WrapMode = WrapMode.Clamp;

                    ColorBlend cb = new ColorBlend(3);
                    cb.Colors = new Color[]{Color.Transparent,
                       Color.FromArgb(50, Color.Black),
                       Color.FromArgb(100, Color.Black)};
                    cb.Positions = new float[] { 0f, .1f, 1f };

                    b.InterpolationColors = cb;

                    e.Graphics.FillPath(b, path);
                }
            }

            //Fill the background
            //using (SolidBrush b = new SolidBrush(ColorTable.ToolTipContentSouth))
            //{
            //   e.Graphics.FillPath(b, dark);
            //}
            using (LinearGradientBrush b = new LinearGradientBrush(
                 e.ClipRectangle, ColorTable.ToolTipContentNorth, ColorTable.ToolTipContentSouth, 90))
            {
                e.Graphics.FillPath(b, dark);
            }

            //Draw the borders
            using (Pen p = new Pen(ColorTable.ToolTipLightBorder))
            {
                e.Graphics.DrawPath(p, light);
            }
            using (Pen p = new Pen(ColorTable.ToolTipDarkBorder))
            {
                e.Graphics.DrawPath(p, dark);
            }

            dark.Dispose();
            light.Dispose();
        }
 public override void OnRenderToolTipText(RibbonToolTipRenderEventArgs e)
 {
     using (Brush b = new SolidBrush(ColorTable.ToolTipText))
     {
         e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
         e.Graphics.DrawString(e.Text, e.Font, b, e.ClipRectangle, e.Format);
     }
 }
 /// <summary>
 /// Renders the text of the Tooltip specified on the event
 /// </summary>
 /// <param name="e">Event data and paint tools</param>
 public virtual void OnRenderToolTipText(RibbonToolTipRenderEventArgs e)
 {
 }
 /// <summary>
 /// Call to draw the Tooltip
 /// </summary>
 /// <param name="e"></param>
 public virtual void OnRenderToolTipBackground(RibbonToolTipRenderEventArgs e)
 {
 }