Пример #1
0
        private void DisplayTooltip()
        {
            if (!ShowSuperTooltips)
            {
                HideToolTip();
                return;
            }

            int rowIndex = GetSelectedRowIndex();

            if (rowIndex == -1)
            {
                return;
            }

            lock (_lastTooltip)
            {
                _lastTooltip.Hide();
                _lastTooltip = new SuperToolTip(_grid);

                int columnCount = _grid.TableDescriptor.Columns.Count;

                var pnt = new Point
                {
                    X = _grid.TableControl.ColIndexToHScrollPixelPos(columnCount),
                    Y = _grid.TableControl.RowIndexToVScrollPixelPos(rowIndex)
                };

                pnt = _grid.PointToScreen(pnt);

                var info = new ToolTipInfo();
                var args = new ToolTipGridEventArgs(info, RowIndexToRecordIndex(rowIndex));

                FirePrepareTooltip(args);
                if (args.Cancel)
                {
                    _lastTooltip.Hide();
                    return;
                }

                info.Header.Font      = new Font(info.Header.Font, FontStyle.Bold);
                _lastTooltip.MaxWidth = ToolTipMaxWidth;
                _lastTooltip.Show(info, pnt, ToolTipDuration);
            }
        }
Пример #2
0
        private void DisplayTooltip()
        {
            lock (_lastTooltip)
            {
                _lastTooltip.Hide();

                if (!ShowSuperTooltip)
                {
                    return;
                }

                if (SelectedNode == null)
                {
                    return;
                }

                _lastTooltip = new SuperToolTip(this)
                {
                    Style       = SuperToolTip.SuperToolTipStyle.Office2013Style,
                    VisualStyle = SuperToolTip.Appearance.Metro,
                    MetroColor  = Color.White,
                    UseFading   = SuperToolTip.FadingType.System
                };

                var rect = SelectedNode.TextBounds;
                var pnt  = new Point(rect.X + rect.Width + 20, rect.Y + rect.Height);
                pnt = PointToScreen(pnt);

                var info = new ToolTipInfo();
                var args = new ToolTipEventArgs(info);

                FirePrepareTooltip(args);

                if (args.Cancel)
                {
                    _lastTooltip.Hide();
                    return;
                }

                info.Header.Font = new Font(info.Header.Font, FontStyle.Bold);

                _lastTooltip.MaxWidth = 450;
                _lastTooltip.Show(info, pnt, ToolTipDuration);
            }
        }