Пример #1
0
        public DeltaHistogram()
        {
            base.GetItemValue   = (di) => di.BytesDelta;
            base.GetItemText    = (di) => di.Traceback.Frames.Array[di.Traceback.Frames.Offset].Function;
            base.GetItemTooltip = (di) => {
                var sf = CustomTooltip.GetDefaultStringFormat();

                var content = new DeltaInfoTooltipContent(
                    di, new DeltaInfo.RenderParams {
                    BackgroundBrush            = new SolidBrush(SystemColors.Info),
                    BackgroundColor            = SystemColors.Info,
                    TextBrush                  = new SolidBrush(SystemColors.InfoText),
                    IsExpanded                 = true,
                    IsSelected                 = false,
                    FunctionHighlightBrush     = new SolidBrush(SystemColors.Highlight),
                    FunctionHighlightTextBrush = new SolidBrush(SystemColors.HighlightText),
                    FunctionFilter             = FunctionFilter,
                    ShadeBrush                 = new SolidBrush(Color.FromArgb(31, 0, 0, 0)),
                    StringFormat               = sf
                }
                    );

                return(content);
            };
        }
Пример #2
0
        protected void ShowTooltip(int itemIndex, Point location)
        {
            if (Tooltip == null)
            {
                Tooltip = new CustomTooltip(this);
            }

            var item = Items[itemIndex];
            var sf   = CustomTooltip.GetDefaultStringFormat();

            using (var g = CreateGraphics()) {
                var content = new DeltaInfoTooltipContent(
                    item, new DeltaInfo.RenderParams {
                    BackgroundBrush            = new SolidBrush(SystemColors.Info),
                    BackgroundColor            = SystemColors.Info,
                    TextBrush                  = new SolidBrush(SystemColors.InfoText),
                    IsExpanded                 = true,
                    IsSelected                 = false,
                    FunctionHighlightBrush     = new SolidBrush(SystemColors.Highlight),
                    FunctionHighlightTextBrush = new SolidBrush(SystemColors.HighlightText),
                    FunctionFilter             = FunctionFilter,
                    Font         = Font,
                    ShadeBrush   = new SolidBrush(Color.FromArgb(31, 0, 0, 0)),
                    StringFormat = sf
                }
                    )
                {
                    Location = this.PointToScreen(location)
                };

                CustomTooltip.FitContentOnScreen(
                    g, content,
                    ref content.RenderParams.Font,
                    ref content.Location, ref content.Size
                    );

                Tooltip.SetContent(content);
            }

            if (_HoverIndex != itemIndex)
            {
                var oldIndex = _HoverIndex;
                _HoverIndex = itemIndex;
                InvalidateItem(oldIndex);
                InvalidateItem(_HoverIndex);
            }
        }