Home > DeveloperSection > Forums > Tooltip background alternation
john rob

Total Post:108

Points:756
Posted on    December-09-2013 11:42 PM

 C# C# 
Ratings:


 1 Reply(s)
 752  View(s)
Rate this:

The single tooltip which shows different messages for different controls. Now the Problem is the background image is not fit/suitable to all messages. I supposed to call the draw event of the tooltip for custom size, Font etc.,

I able to successfully call the draw and Popup event of the tooltip for particular message but setting the generalized size for different messages(e.ToolTipText) is unknown to me.

public void tooltip_Popup(object sender, PopupEventArgs e)

{

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

}

Kindly let me know anybody have any idea about it.



ezra heywood
ezra heywood

Total Post:145

Points:1019
Posted on    December-10-2013 12:02 AM

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);

        }

}


Don't want to miss updates? Please click the below button!

Follow MindStick