Reputation: 14095
I would like to add a horizontal, separating line in my ToolTip in C#. In HTML it is <hr>
. What is it in C# for tool tips ? Hope it's possible without overriding.
ToolTip toolTip1 = new ToolTip();
toolTip1.AutoPopDelay = 5000;
toolTip1.InitialDelay = 0;
toolTip1.ReshowDelay = 500;
toolTip1.ShowAlways = true;
toolTip1.SetToolTip(this, "line1\r\n<hr>\r\nline2");
Upvotes: 0
Views: 1006
Reputation: 1140
It's not gonna work without overriding, but if you change your mind then override default tooltip style and put a line or anything you need into the new style.
MSDN example for custom tooltip style: http://msdn.microsoft.com/en-us/library/ms745107(v=vs.85).aspx Some fancy example: http://www.c-sharpcorner.com/uploadfile/mahesh/creating-fancy-tooltips-in-wpf/
Upvotes: 0
Reputation: 69382
As it's a string literal, you can add spaces manually. Just remember that the spaces before \r\n
won't affect the text so you need to put the spaces before the line2
part.
toolTip1.SetToolTip(this, "line1\r\n\r\n line2");
Upvotes: 0
Reputation: 52952
Try using Environment.NewLine
in your string, eg.
toolTip1.SetToolTip(this, "Fish" + Environment.NewLine + "Sticks");
Upvotes: 1