rbulph said:How to get the height of a tooltip control?
public static void AutoSizeLabelHeight(Label ctlLabel)
{
Graphics g = ctlLabel.CreateGraphics();
Font font = new Font(ctlLabel.Font.Name, ctlLabel.Font.Size, ctlLabel.Font.Style);
StringFormat sf = new StringFormat();
SizeF stringSize = g.MeasureString(ctlLabel.Text, font, ctlLabel.Width, sf);
ctlLabel.Height = (int) stringSize.Height + 2;
g.Dispose();
font.Dispose();
sf.Dispose();
}
Can't find it in the SystemInformation class. I want it because I'm using it as an autotext hint (like in Word) and want to be able to position it properly above the point where the user is typing. I think just using the value that I find on my system should be OK, though.marble_eater said:You can get the font used for ToolTip. It might be in the SystemInformation class. If not, it should be get-able from the Windows API. That is still an iffy way to find a ToolTip size. Why, if you don't mind my asking, are you looking to find the size of a ToolTip?
marble_eater said:Would it be unacceptable to display the hint below the text?