public static void ShowToolTip( Drawing.ColorTable colorTable, SuperToolTipInfo info, Control owner, Point p, bool balloon ) { if( _suppressCount != 0 || WinFormsUtility.Events.MenuLoop.InMenuLoop ) { return; } if( _existing != null ) { if( object.Equals( _existing.Info, info ) ) { return; } else { _existing.Close(); _existing = null; } } _mousePoint = Control.MousePosition; _existing = new SuperToolTip( colorTable, info, p, balloon ); _existing.Show( owner ); }
public SuperToolTip( Drawing.ColorTable colorTable, SuperToolTipInfo info, Point p, bool balloon ) { _colorTable = colorTable; _info = info; _balloon = balloon; using( Graphics g = CreateGraphics() ) { Size size = GetSize( g, info ); _width = size.Width; _height = size.Height; } Position( p ); Setup(); }
public static Size GetSize( Graphics g, SuperToolTipInfo info ) { int width, height; using( Font font = new Font( SystemFonts.DialogFont, FontStyle.Bold ) ) { width = Math.Max( 200, WinFormsUtility.Drawing.GdiPlusEx.MeasureString( g, info.Title, font, int.MaxValue ).Width + 8 ); } height = WinFormsUtility.Drawing.GdiPlusEx.MeasureString( g, info.Title, SystemFonts.DialogFont, width - _bodyIndent ).Height; height += WinFormsUtility.Drawing.GdiPlusEx.MeasureString( g, info.Description, SystemFonts.DialogFont, width - _bodyIndent ).Height; width += _border * 2; height += _border * 2 + _titleSep; return new Size( width, height ); }
private static void Render( Graphics g, Rectangle clip, SuperToolTipInfo info, int width, int height, bool balloon, Drawing.ColorTable colorTable, out VectorGraphics.Primitives.Container container ) { VectorGraphics.Types.Rectangle clipRect = VectorGraphics.Renderers.GdiPlusUtility.Convert.Rectangle( clip ); VectorGraphics.Renderers.GdiPlusRenderer renderer = new VectorGraphics.Renderers.GdiPlusRenderer ( delegate { return g; }, BinaryComponents.VectorGraphics.Renderers.GdiPlusRenderer.MarkerHandling.Ignore, 5 ); container = CreateContainer( renderer, width, height, balloon, colorTable ); g.TranslateTransform( _xoff, _yoff ); renderer.Render( g, container, clipRect ); int titleHeight = WinFormsUtility.Drawing.GdiPlusEx.MeasureString( g, info.Title, SystemFonts.DialogFont, width - _bodyIndent ).Height; Rectangle rect = new Rectangle( 0, 0, width, height ); Rectangle titleRect = new Rectangle( rect.X + _border, rect.Y + _border, rect.Width - _border * 2, titleHeight ); Rectangle bodyRect = new Rectangle( rect.X + _border + _bodyIndent, rect.Y + titleHeight + _border + _titleSep, rect.Width - _border * 2 - _bodyIndent, rect.Height - titleHeight - _border * 2 - _titleSep ); using( Font font = new Font( SystemFonts.DialogFont, FontStyle.Bold ) ) { WinFormsUtility.Drawing.GdiPlusEx.DrawString ( g, info.Title, font, colorTable.TextColor, titleRect , WinFormsUtility.Drawing.GdiPlusEx.TextSplitting.MultiLine, WinFormsUtility.Drawing.GdiPlusEx.Ampersands.Display ); } WinFormsUtility.Drawing.GdiPlusEx.DrawString ( g, info.Description, SystemFonts.DialogFont, colorTable.TextColor , bodyRect, WinFormsUtility.Drawing.GdiPlusEx.TextSplitting.MultiLine, WinFormsUtility.Drawing.GdiPlusEx.Ampersands.Display ); }
public static void Render( Graphics g, Rectangle clip, SuperToolTipInfo info, int width, int height, bool balloon, Drawing.ColorTable colorTable ) { VectorGraphics.Primitives.Container container; Render( g, clip, info, width, height, balloon, colorTable, out container ); }
public static void ShowToolTip( Drawing.ColorTable colorTable, SuperToolTipInfo info, Control owner, Point p ) { ShowToolTip( colorTable, info, owner, p, false ); }