Aligning text in a Tooltip

  • Thread starter Thread starter Rick
  • Start date Start date
R

Rick

Anyone know of a way to align text in a tool tip into columns? I'm looking
for a way of showing two columns, with the text in the second column lining
up under each other.

Thanks in advance.

- Rick
 
better example:
string[] _aS = new string[] {"one", "two", "three", "four", "five"};
StringBuilder _sb = new StringBuilder();
foreach (string _string in _aS)
{
_sb.Append("Beer no:");
_sb.Append("\t"); // tab
_sb.Append(_string);
_sb.Append("\n"); // new line
}
//string _toolTipText = string.Format("column1 {0}\t column2 {1}",
columnValue1, columnValue2);
string _toolTipText = _sb.ToString();
ToolTip.SetTooltip(_ctl, _toolTipText);
 
Thanks for your response Daniel

I considered using the tab character but text in my first column is
sometimes quite short and other times long, exceeding a normal tab position
of every 8 characters.. Tabs simply will not align in this case.


Bamse said:
better example:
string[] _aS = new string[] {"one", "two", "three", "four", "five"};
StringBuilder _sb = new StringBuilder();
foreach (string _string in _aS)
{
_sb.Append("Beer no:");
_sb.Append("\t"); // tab
_sb.Append(_string);
_sb.Append("\n"); // new line
}
//string _toolTipText = string.Format("column1 {0}\t column2 {1}",
columnValue1, columnValue2);
string _toolTipText = _sb.ToString();
ToolTip.SetTooltip(_ctl, _toolTipText);


Bamse said:
try using \t - tab
\n - newline
\v - vertical tab

as stated in MSDN

HTH,
Daniel
 
Back
Top