static void ToolTip2_Draw(object sender, DrawToolTipEventArgs e) { Debug.Assert(BidiHelper.IsRightToLeft, "Tooltip2 should only be ownerdraw when running RTL"); e.DrawBackground(); e.DrawBorder(); e.DrawText(TextFormatFlags.PreserveGraphicsClipping | TextFormatFlags.RightToLeft | TextFormatFlags.Right); }
private void iterationsToolTip_Draw(object sender, System.Windows.Forms.DrawToolTipEventArgs e) { Font f = new Font("Arial", 16.0f); e.DrawBackground(); e.DrawBorder(); e.Graphics.DrawString(e.ToolTipText, f, Brushes.White, new PointF(2, 2)); }
private static void toolTip_Draw(object sender, DrawToolTipEventArgs e) { ToolTip t = (ToolTip)sender; t.BackColor = tooltipBgColor; e.DrawBackground(); e.DrawBorder(); e.Graphics.DrawString(e.ToolTipText, tooltipFont, tooltipFgColor, new PointF(1, 1)); }
void OnDrawEvent(object sender, DrawToolTipEventArgs e) { // Draw the background and border. //e.DrawBackground(); e.DrawBorder(); StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Center; int Margin = 5; int image_wid = 2 * Margin + 100; Rectangle rect = new Rectangle(image_wid, 0, e.Bounds.Width - image_wid, e.Bounds.Height); e.Graphics.DrawString(e.ToolTipText, e.Font, Brushes.Green, rect, sf); }
private void OnDraw(object sender, DrawToolTipEventArgs e) { Rectangle bounds = e.Bounds; bounds.Offset(TOOLTIP_XOFFSET, TOOLTIP_YOFFSET); var br = new SolidBrush(this.ForeColor); var fontsize = e.AssociatedControl.FindForm().Font.Size; var font = new Font(SystemFonts.DefaultFont.FontFamily, fontsize); e.DrawBackground(); e.DrawBorder(); e.Graphics.DrawString(e.ToolTipText, font, br, TOOLTIP_XOFFSET, TOOLTIP_YOFFSET); br.Dispose(); font.Dispose(); }
// use this event to customise the tool tip private void OnDraw(object sender, DrawToolTipEventArgs e) { #if debug var sw = System.Diagnostics.Stopwatch.StartNew(); #endif //long ts = System.Diagnostics.Stopwatch.GetTimestamp(); //if (ts - LastTS < 5000) return; Bounds = e.Bounds; // Store show Bounds Graphics g = e.Graphics; LinearGradientBrush b = new LinearGradientBrush(Bounds, Color.WhiteSmoke, Color.FromArgb(255, ColorBackgrnd), 90f); g.FillRectangle(b, Bounds); e.DrawBorder(); g.SmoothingMode = SmoothingMode.HighQuality; if (HmsItem != null && HmsItem.Words.Count > 0) { DrawFast(g, HmsItem.Words); } else if (OwnWords.Count > 0) { DrawFast(g, OwnWords); } else { float i; WriteWords(GetText(e.ToolTipText, out i), Bounds, g); } b.Dispose(); Visible = true; HmsItem = null; //LastTS = System.Diagnostics.Stopwatch.GetTimestamp(); #if debug sw.Stop(); System.Console.WriteLine("OnDraw: " + sw.ElapsedMilliseconds); #endif }
private void toolTip1_Draw(object sender, DrawToolTipEventArgs e) { //e.Graphics.FillRectangle(new SolidBrush(Color.SteelBlue), e.Bounds); e.DrawBackground(); e.DrawBorder(); TextRenderer.DrawText(e.Graphics, "red", e.Font, e.Bounds, Color.Red); // e.DrawText(); }
private void variableHover_Draw(object sender, DrawToolTipEventArgs e) { using (Font fw = new Font(FontFamily.GenericMonospace, ToolTipFontSize)) { var g = e.Graphics; DrawToolTipEventArgs args = new DrawToolTipEventArgs(g, e.AssociatedWindow, e.AssociatedControl, e.Bounds, e.ToolTipText, variableHover.BackColor, variableHover.ForeColor, fw); args.DrawBackground(); args.DrawBorder(); args.DrawText(TextFormatFlags.TextBoxControl); } }
private void OnDraw(object sender, DrawToolTipEventArgs e) // use this event to customise the tool tip { // Set our background Graphics g = e.Graphics; var n = BackgroundImage.Clone() as Bitmap; var rectSz = e.Bounds.Size; n = ResizeBitmap(n, rectSz.Width, rectSz.Height); g.Clear(Color.FromArgb(50, 50, 50)); g.DrawImage(n, 0, 0); e.DrawBorder(); // Draw our ToolTip title var rectF = new RectangleF(new PointF(8, TitleFont.Height + 10), new Size(tSize.Width - 8, tSize.Height)); if (MaxWidth != 0) { g.DrawString(ToolTipDescription, DescriptionFont, DescriptionBrush, rectF); } else { g.DrawString(ToolTipDescription, DescriptionFont, DescriptionBrush, rectF.Location); }; g.DrawString((Prefix + this.ToolTipTitle + Suffix).Trim('\n'), TitleFont, TitleBrush, new PointF(6, 4)); }
/// <summary> /// The on draw. /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void OnDraw(object sender, DrawToolTipEventArgs e) { e.DrawBorder(); e.DrawBackground(); using (var brush = new SolidBrush(this.ForeColor)) { e.Graphics.DrawString(e.ToolTipText, this.Font, brush, e.Bounds.X + this.Padding.Left, e.Bounds.Y + this.Padding.Top); } }
private void DrawToolTip(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); TextFormatFlags flags = TextFormatFlags.Default | TextFormatFlags.Left | TextFormatFlags.VerticalCenter; if (_writingSystem != null && WritingSystem.RightToLeft) { flags |= TextFormatFlags.RightToLeft; } TextRenderer.DrawText(e.Graphics, e.ToolTipText, _writingSystem.Font, e.Bounds, tooltip.ForeColor, flags); }
/// <summary> /// OnDraw event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void OnDraw(object sender, DrawToolTipEventArgs e) { /* DrawToolTipEventArgs newArgs = new DrawToolTipEventArgs(e.Graphics, e.AssociatedWindow, e.AssociatedControl, e.Bounds, e.ToolTipText, Color.DarkRed, Color.White, new Font("Arial Unicode MS", 8.25f, FontStyle.Bold)); newArgs.DrawBackground(); newArgs.DrawBorder(); newArgs.DrawText(TextFormatFlags.TextBoxControl);*/ e.DrawBackground(); e.DrawBorder(); e.DrawText(); }
private void toolTip_Draw(object sender, DrawToolTipEventArgs e) { Point diagramMousePosition = e.AssociatedControl.PointToClient(MousePosition); string text = string.Format("AAAA {0} {1}\nA Que\n\nCoucou", diagramMousePosition.X, diagramMousePosition.Y); Size textSize = TextRenderer.MeasureText(text, e.Font); Rectangle newBound = new Rectangle(e.Bounds.X + 20, e.Bounds.Y - 20, textSize.Width + 10, textSize.Height + 10); DrawToolTipEventArgs newArgs = new DrawToolTipEventArgs(e.Graphics, e.AssociatedWindow, e.AssociatedControl, newBound, text, this.BackColor, this.ForeColor, e.Font); newArgs.DrawBackground(); newArgs.DrawBorder(); newArgs.DrawText(TextFormatFlags.TextBoxControl); //e.DrawBackground(); //e.DrawBorder(); //using (StringFormat sf = new StringFormat()) //{ // sf.Alignment = StringAlignment.Center; // sf.LineAlignment = StringAlignment.Center; // sf.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.None; // sf.FormatFlags = StringFormatFlags.NoWrap; // using (Font f = new Font("Tahoma", 9)) // { // e.Graphics.DrawString(text, f, // SystemBrushes.ActiveCaptionText, e.Bounds, sf); // } //} //e.DrawText(); }
/// <summary> /// An event handler called when drawing the tooltip. /// </summary> /// <param name="sender">The sender object.</param> /// <param name="e">The event arguments.</param> private void OnDraw(object sender, DrawToolTipEventArgs e) { // Fill the tooltip background. using (SolidBrush brush = new SolidBrush(this.themeSettings.ColorTable.StatusStripNormalBackground)) { e.Graphics.FillRectangle(brush, e.Bounds); } // Draw the tooltip border. e.DrawBorder(); // Draw the icon. e.Graphics.DrawImage(this.icon, this.boundsIcon); // Draw the text. using (Font font = new Font(Window.DefaultFont, FontStyle.Bold)) { TextRenderer.DrawText( e.Graphics, this.messageTitle, font, this.boundsTitle, this.themeSettings.ColorTable.StatusStripNormalText, TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.EndEllipsis); } TextRenderer.DrawText( e.Graphics, this.messageIcmp, Window.DefaultFont, this.boundsIcmp, this.themeSettings.ColorTable.StatusStripNormalText, TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.EndEllipsis); TextRenderer.DrawText( e.Graphics, this.messageHttp, Window.DefaultFont, this.boundsHttp, this.themeSettings.ColorTable.StatusStripNormalText, TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.EndEllipsis); TextRenderer.DrawText( e.Graphics, this.messageHttps, Window.DefaultFont, this.boundsHttps, this.themeSettings.ColorTable.StatusStripNormalText, TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.EndEllipsis); TextRenderer.DrawText( e.Graphics, this.messageUpdated, Window.DefaultFont, this.boundsUpdated, this.themeSettings.ColorTable.StatusStripNormalText, TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.EndEllipsis); }
// Handles drawing the ToolTip. private void toolTip1_Draw(System.Object sender, System.Windows.Forms.DrawToolTipEventArgs e) { // Draw the ToolTip differently depending on which // control this ToolTip is for. // Draw a custom 3D border if the ToolTip is for button1. if (e.AssociatedControl == button1) { // Draw the standard background. e.DrawBackground(); // Draw the custom border to appear 3-dimensional. e.Graphics.DrawLines(SystemPens.ControlLightLight, new Point[] { new Point(0, e.Bounds.Height - 1), new Point(0, 0), new Point(e.Bounds.Width - 1, 0) }); e.Graphics.DrawLines(SystemPens.ControlDarkDark, new Point[] { new Point(0, e.Bounds.Height - 1), new Point(e.Bounds.Width - 1, e.Bounds.Height - 1), new Point(e.Bounds.Width - 1, 0) }); // Specify custom text formatting flags. TextFormatFlags sf = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter | TextFormatFlags.NoFullWidthCharacterBreak; // Draw the standard text with customized formatting options. e.DrawText(sf); } // Draw a custom background and text if the ToolTip is for button2. else if (e.AssociatedControl == button2) { // Draw the custom background. e.Graphics.FillRectangle(SystemBrushes.ActiveCaption, e.Bounds); // Draw the standard border. e.DrawBorder(); // Draw the custom text. // The using block will dispose the StringFormat automatically. using (StringFormat sf = new StringFormat()) { sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; sf.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.None; sf.FormatFlags = StringFormatFlags.NoWrap; using (Font f = new Font("Tahoma", 9)) { e.Graphics.DrawString(e.ToolTipText, f, SystemBrushes.ActiveCaptionText, e.Bounds, sf); } } } // Draw the ToolTip using default values if the ToolTip is for button3. else if (e.AssociatedControl == button3) { e.DrawBackground(); e.DrawBorder(); e.DrawText(); } }
private void _toolTip_Draw(object sender, DrawToolTipEventArgs e) { DashboardButton button = e.AssociatedControl as DashboardButton; // Default behavior for non-button tooltips if (button == null) { e.DrawBackground(); e.DrawBorder(); e.DrawText(); return; } DisplaySettings.Default.PaintBackground(e.Graphics, e.Bounds, this); e.DrawBorder(); string title = button.ThingToShowOnDashboard.LocalizedLongLabel; Font localizedFont = StringCatalog.ModifyFontForLocalization(SystemFonts.DefaultFont); Font boldFont = new Font(localizedFont, FontStyle.Bold); int titleHeight = TextRenderer.MeasureText(e.Graphics, title, boldFont, new Size(e.Bounds.Width - 6, int.MaxValue), ToolTipFormatFlags).Height; Rectangle titleBounds = new Rectangle(e.Bounds.Left + 3, e.Bounds.Top + 3, e.Bounds.Width - 6, e.Bounds.Top + 2 + titleHeight); Rectangle descriptionBounds = new Rectangle(e.Bounds.Left + 18, e.Bounds.Top + 3 + titleHeight, e.Bounds.Width - 21, e.Bounds.Height - 8 - titleHeight); TextRenderer.DrawText(e.Graphics, title, boldFont, titleBounds, Color.Black, ToolTipFormatFlags); TextRenderer.DrawText(e.Graphics, GetToolTipDescription(button.ThingToShowOnDashboard), localizedFont, descriptionBounds, Color.Black, ToolTipFormatFlags); localizedFont.Dispose(); boldFont.Dispose(); }
/* �Զ���ToolTip�ػ溯�����Խ��Win7�±���ɫ�������õ����� */ void tt_Draw(object sender, DrawToolTipEventArgs e) { ToolTip tempTT = (ToolTip)sender; using (Brush backBrush = new SolidBrush(tempTT.BackColor)) { e.Graphics.FillRectangle(backBrush, e.Bounds); e.DrawBorder(); } using (Brush textBrush = new SolidBrush(tempTT.ForeColor)) { StringFormat sf = new StringFormat(); //sf.Alignment = StringAlignment.Center; //sf.LineAlignment = StringAlignment.Center; sf.FormatFlags = StringFormatFlags.NoWrap; sf.Trimming = StringTrimming.None; e.Graphics.DrawString(e.ToolTipText, e.Font, textBrush, e.Bounds, sf); } }
private void _toolTipRtfListOfSearches_Draw(object sender, DrawToolTipEventArgs e) { // Draw the custom background. e.Graphics.FillRectangle(SystemBrushes.Window, e.Bounds); // Draw the standard border. e.DrawBorder(); // Draw the custom text. // The using block will dispose the StringFormat automatically. using (StringFormat sf = new StringFormat()) { //sf.Alignment = StringAlignment.Near; //sf.LineAlignment = StringAlignment.Near; //sf.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.None; //sf.FormatFlags = StringFormatFlags.NoWrap; using (Font f = new Font("Courier New", 10)) { e.Graphics.DrawString(e.ToolTipText, f, SystemBrushes.ActiveCaptionText, e.Bounds, sf); } } }
/// <summary> /// Draws background, border, text, and the image of tooltip /// </summary> /// <param name="sender">object</param> /// <param name="e">DrawToolTipEventArgs</param> private void toolTipSLMIV_Draw(object sender, DrawToolTipEventArgs e) { try { TreeView tview = (TreeView)e.AssociatedWindow; if (tview.SelectedNode != null) { TreeNode tnode = tview.SelectedNode; //Create SLMIVImage which reads the ImageLog SLMIVImage NodeImage = new SLMIVImage(Common.ImageLog); NodeImage.Get(tnode.Name); //Draw the background and border e.DrawBackground(); e.DrawBorder(); //Draw the text StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; Rectangle rect = new Rectangle(125, 0, e.Bounds.Width - (150), e.Bounds.Height); e.Graphics.DrawString(tnode.Text, e.Font, Brushes.Black, rect, sf); if ((((string)tnode.Tag) != "notecard") && (((string)tnode.Tag) != "lsl")) { //Draw the image e.Graphics.DrawImage(NodeImage.Get(tnode.Name), 9, 9); } else { //Does it have a local text file? if (NodeImage.path_image != null && NodeImage.path_image.ToLower().Trim().EndsWith(".txt")) { System.Drawing.Image image = new Bitmap(SLMIV.Resources.Folder_open, 120, 120); e.Graphics.DrawImage(image, 9, 9); } else if (NodeImage.path_image != null && NodeImage.path_image.ToLower().Trim().EndsWith(".lsl")) { System.Drawing.Image image = new Bitmap(SLMIV.Resources.Folder_open, 120, 120); e.Graphics.DrawImage(image, 9, 9); //Draw the no image //e.Graphics.DrawImage(System.Drawing.Image.FromHbitmap(SLMIV.Resources.Nonecircle.GetHbitmap()), 9, 9); } else { //Draw the no image System.Drawing.Image image = new Bitmap(SLMIV.Resources.Nonecircle, 120, 120); e.Graphics.DrawImage(image, 9, 9); } } } } catch (Exception ex) { } }
// use this event to customise the tool tip private void OnDraw(object sender, DrawToolTipEventArgs e) { Bounds = e.Bounds; // Store show Bounds HmsToolTip tip = sender as HmsToolTip; Graphics g = e.Graphics; LinearGradientBrush b = new LinearGradientBrush(Bounds, Color.White, Color.FromArgb(0xE4, 0xE5, 0xF0), 90f); g.FillRectangle(b, Bounds); e.DrawBorder(); g.SmoothingMode = SmoothingMode.HighQuality; float i; WriteWords(GetText(e.ToolTipText, out i), Bounds, g); Visible = true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Handles the draw. /// </summary> /// ------------------------------------------------------------------------------------ void HandleDraw(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); Form frm = m_ctrl.FindForm(); TextFormatFlags flags = (frm.RightToLeft == RightToLeft.Yes ? TextFormatFlags.RightToLeft : TextFormatFlags.Left) | TextFormatFlags.VerticalCenter; TextRenderer.DrawText(e.Graphics, ToolTipTitle, m_fntTitle, m_rcTitle, SystemColors.InfoText, flags); TextRenderer.DrawText(e.Graphics, m_text, m_fntText, m_rcText, SystemColors.InfoText, flags); // Draw the icon if (m_showMissingGlyphIcon) { Point pt = m_rcTitle.Location; pt.X -= (m_missingGlyphIcon.Width + 5); if (m_missingGlyphIcon.Height > m_rcTitle.Height) pt.Y -= (int)((m_missingGlyphIcon.Height - m_rcTitle.Height) / 2); e.Graphics.DrawImageUnscaled(m_missingGlyphIcon, pt); } // Draw a line separating the title from the text below it. Point pt1 = new Point(e.Bounds.X + 7, m_rcTitle.Bottom + 7); Point pt2 = new Point(e.Bounds.Right - 5, m_rcTitle.Bottom + 7); using (LinearGradientBrush br = new LinearGradientBrush(pt1, pt2, SystemColors.InfoText, SystemColors.Info)) { e.Graphics.DrawLine(new Pen(br, 1), pt1, pt2); } }
/// <summary> /// Trata el evento de dibujo del toolTip /// </summary> private void ToolTipExtend_Draw(Object sender, DrawToolTipEventArgs e) { if (IsToolTipExtend && IsAssignedControl(e.AssociatedControl)) { // Dibujar fondo con un gradiente de acuerdo al tema de Windows XP Color color1 = SystemColors.Info, color2 = SystemColors.Info; // Identificar que tema se esta usando switch (GetTheme()) { case "Metallic": color1 = Color.FromArgb(249, 249, 255); color2 = Color.FromArgb(164, 163, 190); break; case "NormalColor": color1 = Color.FromArgb(227, 239, 255); color2 = Color.FromArgb(121, 161, 220); break; case "HomeStead": color1 = Color.FromArgb(250, 251, 230); color2 = Color.FromArgb(164, 180, 120); break; } // Pintar el color de fondo e.Graphics.FillRectangle(new LinearGradientBrush(new Point(0, 0), new Point(0, szToolTip.Height), color1, color2), new Rectangle(0, 0, szToolTip.Width, szToolTip.Height)); // Dibujar borde con apariencia 3D e.Graphics.DrawLines(SystemPens.ControlLightLight, new Point[] { new Point(0, szToolTip.Height - 1), new Point(0, 0), new Point(szToolTip.Width - 1, 0)}); e.Graphics.DrawLines(SystemPens.ControlDarkDark, new Point[] {new Point(0, szToolTip.Height - 1), new Point(szToolTip.Width - 1, szToolTip.Height - 1), new Point(szToolTip.Width - 1, 0)}); // Imprimir titulo, si existe if (!string.IsNullOrEmpty(GetTitle(e.AssociatedControl))) e.Graphics.DrawString(GetTitle(e.AssociatedControl), arrObjSection[(int) enumSection.SectionTitle].FontText, new SolidBrush(Color.Black), arrObjSection[(int) enumSection.SectionTitle].Position); // Dibujar icono en la esquina superior derecha, si existe Bitmap icono = (Bitmap) GetIcon(e.AssociatedControl); if (icono != null) { icono.MakeTransparent(Color.Magenta); e.Graphics.DrawImage(icono, arrObjSection[(int) enumSection.SectionIcon].Position); } // Dibujar imagen descriptiva, si existe // Si es una imagen ancha se mostrará horizontalmente y el texto descriptivo estará debajo de la imagen // Si es una imagen alta se mostrará verticalmente y el texto descriptivo estará en la parte derecha de la imagen Image imagen = GetImage(e.AssociatedControl); if (imagen != null) e.Graphics.DrawImage(imagen, new Rectangle(arrObjSection[(int) enumSection.SectionImage].Position.X, arrObjSection[(int) enumSection.SectionImage].Position.Y, imagen.Width, imagen.Height)); // Imprimir texto descriptivo // El texto se imprime de acuerdo a si existe o no una imagen descriptiva // La orientación del texto depende de donde se coloque la imagen descriptiva e.Graphics.DrawString(GetToolTip(e.AssociatedControl), arrObjSection[(int) enumSection.SectionText].FontText, new SolidBrush(Color.Black), arrObjSection[(int) enumSection.SectionText].Position); // Dibujar línea de separación e imprimir texto de pie de ToolTipExtend, si existe if (!string.IsNullOrEmpty(GetFooter(e.AssociatedControl))) { e.Graphics.DrawLine(new Pen(Color.Black), new Point(1, intPositionLine), new Point(szToolTip.Width - 1, intPositionLine)); e.Graphics.DrawString(GetFooter(e.AssociatedControl), arrObjSection[(int) enumSection.SectionFoot].FontText, new SolidBrush(Color.Black), arrObjSection[(int) enumSection.SectionFoot].Position); } } else { e.DrawBackground(); e.DrawBorder(); e.DrawText(TextFormatFlags.NoFullWidthCharacterBreak | TextFormatFlags.VerticalCenter); } }
private void changeButtonToolTip_Draw(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); e.Graphics.DrawString(e.ToolTipText, changeButtonFont, Brushes.Black, new PointF(0, 0)); }
private void tp_Draw(object sender, System.Windows.Forms.DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); e.DrawText(); }
//user drawn event handler for toolTip private void toolTipHint_Draw(object sender, DrawToolTipEventArgs e) { e.DrawBackground(); e.DrawBorder(); e.DrawText(); }
void OPMToolTip_Draw(object sender, DrawToolTipEventArgs e) { if (e.AssociatedControl != null && _data.ContainsKey(e.AssociatedControl)) { e.Graphics.CompositingMode = CompositingMode.SourceOver; e.Graphics.CompositingQuality = CompositingQuality.HighQuality; e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit; e.Graphics.TextContrast = 5; //e.DrawBackground(); //e.DrawBorder(); using (LinearGradientBrush b = new LinearGradientBrush(e.Bounds, ControlPaint.Light(ThemeManager.GradientNormalColor1), ControlPaint.Light(ThemeManager.GradientNormalColor2), 90)) { e.Graphics.FillRectangle(b, e.Bounds); } using (Pen p = new Pen(ThemeManager.BorderColor)) { Rectangle rc = new Rectangle(e.Bounds.Location, new Size(e.Bounds.Width - 1, e.Bounds.Height - 1)); e.Graphics.DrawRectangle(p, rc); } DrawContents(e.Graphics, _data[e.AssociatedControl]); } else { // Fallback to regular tooltip e.DrawBorder(); e.DrawBackground(); e.DrawText(); } }