Ejemplo n.º 1
0
        /// <summary>
        /// Raises the MouseEnter event
        /// </summary>
        /// <param name="e">A CellMouseEventArgs that contains the event data</param>
        public virtual void OnMouseEnter(CellMouseEventArgs e)
        {
            this.Bounds = e.CellRect;

            this.Padding = e.Cell == null ? CellPadding.Empty : e.Cell.Padding;

            bool tooltipActive = e.Table.ToolTip.Active;

            if (tooltipActive)
                e.Table.ToolTip.Active = false;

            e.Table.ResetMouseEventArgs();

            if (tooltipActive)
            {
                if (e.Cell != null)
                {
                    CellToolTipEventArgs args = new CellToolTipEventArgs(e.Cell, new Point(e.X, e.Y));

                    // The default tooltip is to show the full text for any cell that has been truncated
                    if (e.Cell.IsTextTrimmed)
                        args.ToolTipText = e.Cell.Text;

                    // Allow the outside world to modify the text or cancel this tooltip
                    e.Table.OnCellToolTipPopup(args);

                    // Even if this tooltip has been cancelled we need to get rid of the old tooltip
                    if (args.Cancel)
                        e.Table.ToolTip.SetToolTip(e.Table, string.Empty);
                    else
                        e.Table.ToolTip.SetToolTip(e.Table, args.ToolTipText);
                }
                else
                {
                    e.Table.ToolTip.SetToolTip(e.Table, string.Empty);
                }
                e.Table.ToolTip.Active = true;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Raises the CellToolTipPopup event
 /// </summary>
 /// <param name="e">A CellToolTipEventArgs that contains the event data</param>
 protected internal virtual void OnCellToolTipPopup(CellToolTipEventArgs e)
 {
     if (this.CanRaiseEvents && CellToolTipPopup != null)
         CellToolTipPopup(this, e);
 }