---
title: "Tooltip background alternation"  
description: "Tooltip background alternation"  
author: "Anonymous User"  
published: 2013-12-09  
updated: 2013-12-10  
canonical: https://www.mindstick.com/forum/1758/tooltip-background-alternation  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Tooltip background alternation

The single [tooltip](https://www.mindstick.com/articles/1529/simple-tooltip-using-html-css) which shows different [messages](https://www.mindstick.com/news/4166/google-rolling-out-gemini-extensions-for-messages-whatsapp-and-spotify) for different controls. Now the [Problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) is the [background image](https://www.mindstick.com/forum/539/css-background-image-properties-not-work-in-outlook) is not fit/suitable to all messages. I supposed to call the draw [event](https://www.mindstick.com/articles/167719/marquee-hire-benefits-of-event-lighting-hire-london) of the tooltip for [custom](https://www.mindstick.com/blog/12298/use-custom-writing-services-to-get-through-the-finals) size, Font etc.,

I able to successfully call the draw and Popup event of the tooltip for particular [message](https://www.mindstick.com/forum/12802/show-confirmation-message-yes-or-no-in-asp-dot-net) but setting the generalized size for different messages(e.ToolTipText) is unknown to me.

[public void](https://www.mindstick.com/interview/2715/can-we-write-static-public-void-instead-of-public-static-void) tooltip_Popup(object sender, PopupEventArgs e)

{

e.ToolTipSize = new Size(100, 100);

}

Kindly let me know anybody have any idea about it.

## Replies

### Reply by Anonymous User

Hi john,\

I found the answer for your Problem. The below code of POPUP event will change the tooltipsize according to the text size.

```
public void toolTip_Popup(object sender, PopupEventArgs e) {        using (Font f = new Font("Arial", 12f))        {            e.ToolTipSize = TextRenderer.MeasureText(                toolTips.GetToolTip(e.AssociatedControl), f);        }}
```


---

Original Source: https://www.mindstick.com/forum/1758/tooltip-background-alternation

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
