Ejemplo n.º 1
0
        /// <summary>
        /// Measures the bounds of the container
        /// </summary>
        public virtual void MeasureBounds()
        {
            _htmlContainer.SetBounds(this is HtmlLabel ? new Rectangle(0, 0, 10, 10) : ClientRectangle);

            using (Graphics g = CreateGraphics())
            {
                _htmlContainer.MeasureBounds(g);
            }

            AutoScrollMinSize = Size.Round(_htmlContainer.MaximumSize);
        }
Ejemplo n.º 2
0
        void HtmlToolTip_Popup(object sender, PopupEventArgs e)
        {
            string text = this.GetToolTip(e.AssociatedControl);
            string font = string.Format(NumberFormatInfo.InvariantInfo, "font: {0}pt {1}", e.AssociatedControl.Font.Size, e.AssociatedControl.Font.FontFamily.Name);

            //Create fragment container
            container = new InitialContainer("<table class=htmltooltipbackground cellspacing=5 cellpadding=0 style=\"" + font + "\"><tr><td style=border:0px>" + text + "</td></tr></table>");
            container.SetBounds(new Rectangle(0, 0, 10, 10));
            container.AvoidGeometryAntialias = true;

            //Measure bounds of the container
            using (IGraphics g = new GraphicsWrapper(e.AssociatedControl.CreateGraphics()))
            {
                container.MeasureBounds(g);
            }

            //Set the size of the tooltip
            e.ToolTipSize = Size.Round(container.MaximumSize);
        }