I want to show the ToolTip message below the TextBox , but also want them to be right-aligned.
I managed to place the ToolTip message on the right edge of the text box, so I tried to move the message to the left of the message length.
So, I tried to get the length of the string using TextRenderer.MeasureText (), but the position is a bit discharged, as shown below.

private void button1_Click(object sender, EventArgs e) { ToolTip myToolTip = new ToolTip(); string test = "This is a test string."; int textWidth = TextRenderer.MeasureText(test, SystemFonts.DefaultFont, textBox1.Size, TextFormatFlags.LeftAndRightPadding).Width; int toolTipTextPosition_X = textBox1.Size.Width - textWidth; myToolTip.Show(test, textBox1, toolTipTextPosition_X, textBox1.Size.Height); }
I tried using different flags in the MeasureText () function, but that did not help, and since the ToolTip message is indented, I went for TextFormatFlags.LeftAndRightPadding.
To be clear, this is what I would like to achieve:

source share