SetContent() public method

public SetContent ( TooltipContentBase content ) : void
content TooltipContentBase
return void
Esempio n. 1
0
        protected void ShowTooltip(int itemIndex, Point location)
        {
            if (Tooltip == null)
            {
                Tooltip = new CustomTooltip(this);
            }

            var item = Items[itemIndex];

            using (var g = CreateGraphics()) {
                var content = GetItemTooltip(item);

                content.Font     = Font;
                content.Location = PointToScreen(location);

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

                Tooltip.SetContent(content);
            }

            if (_HoverIndex != itemIndex)
            {
                var oldIndex = _HoverIndex;
                _HoverIndex = itemIndex;
                InvalidateItem(oldIndex);
                InvalidateItem(_HoverIndex);
            }
        }
Esempio n. 2
0
        protected IEnumerator <object> FinishShowingTooltip(
            Point mouseLocation,
            HeapSnapshot.Heap heap,
            HeapSnapshot.Allocation allocation,
            HeapSnapshot.Traceback rawTraceback
            )
        {
            var uniqueRawFrames = rawTraceback.Frames.AsEnumerable().Distinct();

            var fSymbols = Instance.Database.SymbolCache.Select(uniqueRawFrames);

            using (fSymbols)
                yield return(fSymbols);

            var symbolDict = SequenceUtils.ToDictionary(
                uniqueRawFrames, fSymbols.Result
                );

            var tracebackInfo = HeapRecording.ConstructTracebackInfo(
                rawTraceback.ID, rawTraceback.Frames, symbolDict
                );

            var renderParams = new DeltaInfo.RenderParams {
                BackgroundBrush = new SolidBrush(SystemColors.Info),
                BackgroundColor = SystemColors.Info,
                TextBrush       = new SolidBrush(SystemColors.InfoText),
                IsExpanded      = true,
                IsSelected      = false,
                Font            = Font,
                ShadeBrush      = new SolidBrush(Color.FromArgb(31, 0, 0, 0)),
                StringFormat    = CustomTooltip.GetDefaultStringFormat()
            };

            var content = new HeapSnapshot.AllocationTooltipContent(
                ref allocation, ref tracebackInfo, ref renderParams
                )
            {
                Location = mouseLocation,
                Font     = Font
            };

            using (var g = CreateGraphics())
                CustomTooltip.FitContentOnScreen(
                    g, content,
                    ref content.RenderParams.Font,
                    ref content.Location, ref content.Size
                    );

            Tooltip.SetContent(content);
        }
Esempio n. 3
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);
            }
        }
Esempio n. 4
0
        protected void ShowTooltip(LayoutItem item, Point location)
        {
            if (Tooltip == null)
            {
                Tooltip = new CustomTooltip(this);
            }

            using (var g = CreateGraphics()) {
                var content = GetItemTooltip(item.Item);

                content.Font     = Font;
                content.Location = PointToScreen(new Point(
                                                     (int)item.Rectangle.Left,
                                                     (int)item.Rectangle.Bottom + 2
                                                     ));

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

                Tooltip.SetContent(content);
            }

            if (_HoverItem != item)
            {
                var oldItem = _HoverItem;
                _HoverItem = item;

                if (oldItem != null)
                {
                    Invalidate(oldItem.Rectangle);
                }

                Invalidate(item.Rectangle);
            }
        }