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

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

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

                var 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)
                {
                    var f = new Font(_Font, FontStyle.Bold);
                    eTip.ClipRectangle = _TitleRectangle;
                    eTip.Text          = ToolTipTitle;
                    eTip.Font          = f;
                    Owner.Renderer.OnRenderToolTipText(eTip);
                    f.Dispose();
                }
            }

            catch (Exception ex)
            {
                var logMessage = "Exception in RibbonToolTip_Draw (object, DrawToolTipEventArgs) " + ex;
                Trace.TraceError(logMessage);
                throw;
            }
        }
Пример #2
0
 /// <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)
 {
 }
Пример #3
0
 /// <summary>
 ///     Call to draw the Tooltip
 /// </summary>
 /// <param name="e"></param>
 public virtual void OnRenderToolTipBackground(RibbonToolTipRenderEventArgs e)
 {
 }